Prints the supplied node tree. @param node the node to print
(Node node)
| 69 | * @param node the node to print |
| 70 | */ |
| 71 | public void print(Node node) { |
| 72 | out.printIndent(); |
| 73 | printName(node); |
| 74 | Map attributes = node.attributes(); |
| 75 | boolean hasAttributes = attributes != null && !attributes.isEmpty(); |
| 76 | if (hasAttributes) { |
| 77 | printAttributes(attributes); |
| 78 | } |
| 79 | Object value = node.value(); |
| 80 | if (value instanceof List) { |
| 81 | if (!hasAttributes) { |
| 82 | out.print("()"); |
| 83 | } |
| 84 | printList((List) value); |
| 85 | } else { |
| 86 | if (value instanceof String) { |
| 87 | out.print("('"); |
| 88 | out.print((String) value); |
| 89 | out.println("')"); |
| 90 | } else { |
| 91 | out.println("()"); |
| 92 | } |
| 93 | } |
| 94 | out.flush(); |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Prints the node name. |
no test coverage detected