Deprecated
groovy.util.Node (as used with XmlParser) including all children in XML format.
Typical usage:
def xml = '<html><head><title>Title</title></head><body><h1>Header</h1></body></html>' def root = new XmlParser().parseText(xml) new XmlNodePrinter(preserveWhitespace:true).print(root.body[0])which when run produces this on stdout (or use your own
PrintWriter to direct elsewhere):
<body> <h1>Header</h1> </body>
groovy.util.NodePrinter , groovy.xml.XmlUtil#serialize(Node)
| Modifier and Type | Class and Description |
|---|---|
| protected static class | XmlNodePrinter.NamespaceContext
Deprecated
|
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private boolean | |
| protected final IndentPrinter | |
| private boolean | |
| private String |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private String | |
| public String | |
| private static boolean | |
| public boolean | Returns: true, if empty elements will be represented by an opening tag
followed immediately by a closing tag.Whether empty elements are expanded from <tagName/> to <tagName></tagName>. |
| private boolean | |
| public boolean | Returns: true if namespace handling is enabledCheck if namespace handling is enabled. |
| public boolean | Returns: true if whitespaces are honoured when printing simple text nodesCheck if whitespace preservation is enabled. |
| public void | |
| protected void | print(Node node, XmlNodePrinter.
Deprecated
as a consequence of
XmlNodePrinter.NamespaceContext being deprecated.
|
| private void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | printList(List<E> list, XmlNodePrinter.
Deprecated
as a consequence of
XmlNodePrinter.NamespaceContext being deprecated.
|
| protected void | printName(Node node, XmlNodePrinter.
Deprecated
as a consequence of
XmlNodePrinter.NamespaceContext being deprecated.
|
| protected void | printNameAttributes(Map<K, V> attributes, XmlNodePrinter.
Deprecated
as a consequence of
XmlNodePrinter.NamespaceContext being deprecated.
|
| protected void | printNamespace(Object object, XmlNodePrinter.
Deprecated
as a consequence of
XmlNodePrinter.NamespaceContext being deprecated.
|
| protected void | |
| private void | |
| protected boolean | |
| public void | setExpandEmptyElements(boolean
if expandEmptyElements)true, empty
elements will be represented by an opening tag
followed immediately by a closing tag.
Defaults to false.Whether empty elements are expanded from <tagName/> to <tagName></tagName>. |
| public void | setNamespaceAware(boolean
the new desired value namespaceAware)Enable and/or disable namespace handling. |
| public void | setPreserveWhitespace(boolean
the new desired value preserveWhitespace)Enable and/or disable preservation of whitespace. |
| public void |
| expandEmptyElements | back to summary |
|---|---|
| private boolean expandEmptyElements | |
| namespaceAware | back to summary |
|---|---|
| private boolean namespaceAware | |
| out | back to summary |
|---|---|
| protected final IndentPrinter out | |
| preserveWhitespace | back to summary |
|---|---|
| private boolean preserveWhitespace | |
| quote | back to summary |
|---|---|
| private String quote | |
| XmlNodePrinter | back to summary |
|---|---|
| public XmlNodePrinter(PrintWriter out) | |
| XmlNodePrinter | back to summary |
|---|---|
| public XmlNodePrinter(PrintWriter out, String indent) | |
| XmlNodePrinter | back to summary |
|---|---|
| public XmlNodePrinter(PrintWriter out, String indent, String quote) | |
| XmlNodePrinter | back to summary |
|---|---|
| public XmlNodePrinter(IndentPrinter out) | |
| XmlNodePrinter | back to summary |
|---|---|
| public XmlNodePrinter(IndentPrinter out, String quote) | |
| XmlNodePrinter | back to summary |
|---|---|
| public XmlNodePrinter() | |
| getName | back to summary |
|---|---|
| private String getName(Object object) | |
| getQuote | back to summary |
|---|---|
| public String getQuote() Get Quote to use when printing attributes.
| |
| isEmptyElement | back to summary |
|---|---|
| private static boolean isEmptyElement(Node node) | |
| isExpandEmptyElements | back to summary |
|---|---|
| public boolean isExpandEmptyElements() Whether empty elements are expanded from <tagName/> to <tagName></tagName>.
| |
| isListOfSimple | back to summary |
|---|---|
| private boolean isListOfSimple(List<E> value) | |
| isNamespaceAware | back to summary |
|---|---|
| public boolean isNamespaceAware() Check if namespace handling is enabled.
Defaults to
| |
| isPreserveWhitespace | back to summary |
|---|---|
| public boolean isPreserveWhitespace() Check if whitespace preservation is enabled.
Defaults to
| |
| back to summary | |
|---|---|
| public void print(Node node) | |
| back to summary | |
|---|---|
| protected void print(Node node, XmlNodePrinter. Deprecated as a consequence of | |
| printEscaped | back to summary |
|---|---|
| private void printEscaped(String s, boolean isAttributeValue) | |
| printLineBegin | back to summary |
|---|---|
| protected void printLineBegin() | |
| printLineEnd | back to summary |
|---|---|
| protected void printLineEnd() | |
| printLineEnd | back to summary |
|---|---|
| protected void printLineEnd(String comment) | |
| printList | back to summary |
|---|---|
| protected void printList(List<E> list, XmlNodePrinter. Deprecated as a consequence of | |
| printName | back to summary |
|---|---|
| protected void printName(Node node, XmlNodePrinter. Deprecated as a consequence of | |
| printNameAttributes | back to summary |
|---|---|
| protected void printNameAttributes(Map<K, V> attributes, XmlNodePrinter. Deprecated as a consequence of | |
| printNamespace | back to summary |
|---|---|
| protected void printNamespace(Object object, XmlNodePrinter. Deprecated as a consequence of | |
| printSimpleItem | back to summary |
|---|---|
| protected void printSimpleItem(Object value) | |
| printSimpleItemWithIndent | back to summary |
|---|---|
| private void printSimpleItemWithIndent(Object value) | |
| printSpecialNode | back to summary |
|---|---|
| protected boolean printSpecialNode(Node node) | |
| setExpandEmptyElements | back to summary |
|---|---|
| public void setExpandEmptyElements(boolean expandEmptyElements) Whether empty elements are expanded from <tagName/> to <tagName></tagName>.
| |
| setNamespaceAware | back to summary |
|---|---|
| public void setNamespaceAware(boolean namespaceAware) Enable and/or disable namespace handling.
| |
| setPreserveWhitespace | back to summary |
|---|---|
| public void setPreserveWhitespace(boolean preserveWhitespace) Enable and/or disable preservation of whitespace.
| |
| setQuote | back to summary |
|---|---|
| public void setQuote(String quote) Set Quote to use when printing attributes.
| |
Deprecated
| Access | Constructor and Description |
|---|---|
| public | |
| public | NamespaceContext(XmlNodePrinter.
Deprecated
as a consequence of
XmlNodePrinter.NamespaceContext being deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public boolean | |
| public void |
| namespaceMap | back to summary |
|---|---|
| private final Map<String, String> namespaceMap | |
| NamespaceContext | back to summary |
|---|---|
| public NamespaceContext() | |
| NamespaceContext | back to summary |
|---|---|
| public NamespaceContext(XmlNodePrinter. Deprecated as a consequence of | |
| getNamespace | back to summary |
|---|---|
| public String getNamespace(String prefix) | |
| isPrefixRegistered | back to summary |
|---|---|
| public boolean isPrefixRegistered(String prefix, String uri) | |
| registerNamespacePrefix | back to summary |
|---|---|
| public void registerNamespacePrefix(String prefix, String uri) | |