in dbus-java-utils/src/main/java/org/freedesktop/dbus/viewer/DBusViewer.java [262:297]
public void visitNode(String name, String path) throws DBusException, SAXException, IOException {
System.out.println("visit " + name + ":" + path);
if ("/org/freedesktop/DBus/Local".equals(path)) {
// this will disconnects us.
return;
}
DBusEntry e = addEntry(name, path);
String introspectData = e.getIntrospectable().Introspect();
Document document = builder.parse(new InputSource(new StringReader(introspectData.replace(DOC_TYPE, ""))));
Element root = document.getDocumentElement();
NodeList children = root.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if (Node.ELEMENT_NODE != node.getNodeType()) {
continue;
}
if ("node".equals(node.getNodeName())) {
Node nameNode = node.getAttributes().getNamedItem("name");
if (nameNode != null) {
try {
if (path.endsWith("/")) {
visitNode(name, path + nameNode.getNodeValue());
} else {
visitNode(name, path + '/' + nameNode.getNodeValue());
}
} catch (DBusException ex) {
ex.printStackTrace();
}
}
}
}
}