List of utility methods to do XML Node Print
void | prettyPrint(Node root) Can help debug Node objects from IIOMetadata#getAsTree(String) . displayMetadata(root, 0); |
void | prettyPrintLoop(Node node, StringBuilder string, String indentation) pretty Print Loop if (node == null) { return; int type = node.getNodeType(); switch (type) { case Node.DOCUMENT_NODE: string.append("\n"); prettyPrintLoop(node.getChildNodes(), string, indentation + "\t"); ... |
String | prettyPrintNode(Node aNode, int indent) pretty Print Node StringBuilder str = new StringBuilder(); if (aNode.getNodeType() == Node.ELEMENT_NODE) { String uri = aNode.getNamespaceURI() == null ? "" : (" xmlns=\"" + aNode.getNamespaceURI() + "\""); StringBuilder attrs = new StringBuilder(); NamedNodeMap attrss = aNode.getAttributes(); for (int k = 0; k < attrss.getLength(); k++) { Node atr = attrss.item(k); attrs.append(" " + atr.getNodeName() + "=\"" + atr.getNodeValue() + "\""); ... |
String | print(Node node) Print a Node tree recursively. if (node == null) { return null; StringBuffer xml = new StringBuffer(100); int type = node.getNodeType(); switch (type) { case Node.ELEMENT_NODE: { xml.append('<'); ... |
void | print(Node node) Prints the specified node, recursively. if (node == null) { return; System.out.println(""); int type = node.getNodeType(); switch (type) { case Node.DOCUMENT_NODE: { print(((Document) node).getDocumentElement()); ... |
void | printArrayContent(Node[] t) print Array Content for (Node o : t) {
System.out.println(o.getNodeName());
|
void | printDifferences(Node node1, Node node2) print Differences if (node1.getNodeType() == Node.DOCUMENT_NODE) node1 = ((Document) node1).getDocumentElement(); if (node2.getNodeType() == Node.DOCUMENT_NODE) node2 = ((Document) node2).getDocumentElement(); if (node1.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attrs1 = node1.getAttributes(); NamedNodeMap attrs2 = node2.getAttributes(); Node child1, child2; ... |
void | printDOM(Node node) Prints the specified node, then prints all of its children. int type = node.getNodeType(); switch (type) { case Node.DOCUMENT_NODE: { System.out.println("<?xml version=\"1.0\" ?>"); printDOM(((Document) node).getDocumentElement()); break; case Node.ELEMENT_NODE: { ... |
void | printDOM(Node node, String prefix) Prints the specified node, then prints all of its children. int type = node.getNodeType(); switch (type) { case Node.DOCUMENT_NODE: { System.out.println("<?xml version=\"1.0\" ?>"); printDOM(((Document) node).getDocumentElement(), prefix + " "); break; case Node.ELEMENT_NODE: { ... |
void | printDOMTree(Node node, PrintStream out) For debug purpose. int type = node.getNodeType(); switch (type) { case Node.DOCUMENT_NODE: { printDOMTree(((Document) node).getDocumentElement(), out); break; case Node.ELEMENT_NODE: { out.print("<"); ... |