Package groovy.util
Class XmlNodePrinter
java.lang.Object
groovy.util.XmlNodePrinter
@Deprecated public class XmlNodePrinter extends Object
Deprecated.
use
XmlNodePrinterPrints a
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>
- See Also:
NodePrinter,XmlUtil.serialize(Node)
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classXmlNodePrinter.NamespaceContextDeprecated. -
Field Summary
Fields Modifier and Type Field Description protected groovy.util.IndentPrinteroutDeprecated. -
Constructor Summary
Constructors Constructor Description XmlNodePrinter()Deprecated.XmlNodePrinter(groovy.util.IndentPrinter out)Deprecated.XmlNodePrinter(groovy.util.IndentPrinter out, String quote)Deprecated.XmlNodePrinter(PrintWriter out)Deprecated.XmlNodePrinter(PrintWriter out, String indent)Deprecated.XmlNodePrinter(PrintWriter out, String indent, String quote)Deprecated. -
Method Summary
Modifier and Type Method Description StringgetQuote()Deprecated.Get Quote to use when printing attributes.booleanisExpandEmptyElements()Deprecated.Whether empty elements are expanded from <tagName/> to <tagName></tagName>.booleanisNamespaceAware()Deprecated.Check if namespace handling is enabled.booleanisPreserveWhitespace()Deprecated.Check if whitespace preservation is enabled.voidprint(groovy.util.Node node)Deprecated.protected voidprint(groovy.util.Node node, XmlNodePrinter.NamespaceContext ctx)Deprecated.protected voidprintLineBegin()Deprecated.protected voidprintLineEnd()Deprecated.protected voidprintLineEnd(String comment)Deprecated.protected voidprintList(List list, XmlNodePrinter.NamespaceContext ctx)Deprecated.protected voidprintName(groovy.util.Node node, XmlNodePrinter.NamespaceContext ctx, boolean begin, boolean preserve)Deprecated.protected voidprintNameAttributes(Map attributes, XmlNodePrinter.NamespaceContext ctx)Deprecated.protected voidprintNamespace(Object object, XmlNodePrinter.NamespaceContext ctx)Deprecated.protected voidprintSimpleItem(Object value)Deprecated.protected booleanprintSpecialNode(groovy.util.Node node)Deprecated.voidsetExpandEmptyElements(boolean expandEmptyElements)Deprecated.Whether empty elements are expanded from <tagName/> to <tagName></tagName>.voidsetNamespaceAware(boolean namespaceAware)Deprecated.Enable and/or disable namespace handling.voidsetPreserveWhitespace(boolean preserveWhitespace)Deprecated.Enable and/or disable preservation of whitespace.voidsetQuote(String quote)Deprecated.Set Quote to use when printing attributes.
-
Field Details
-
out
protected final groovy.util.IndentPrinter outDeprecated.
-
-
Constructor Details
-
XmlNodePrinter
Deprecated. -
XmlNodePrinter
Deprecated. -
XmlNodePrinter
Deprecated. -
XmlNodePrinter
public XmlNodePrinter(groovy.util.IndentPrinter out)Deprecated. -
XmlNodePrinter
Deprecated. -
XmlNodePrinter
public XmlNodePrinter()Deprecated.
-
-
Method Details
-
print
public void print(groovy.util.Node node)Deprecated. -
isNamespaceAware
public boolean isNamespaceAware()Deprecated.Check if namespace handling is enabled. Defaults totrue.- Returns:
- true if namespace handling is enabled
-
setNamespaceAware
public void setNamespaceAware(boolean namespaceAware)Deprecated.Enable and/or disable namespace handling.- Parameters:
namespaceAware- the new desired value
-
isPreserveWhitespace
public boolean isPreserveWhitespace()Deprecated.Check if whitespace preservation is enabled. Defaults tofalse.- Returns:
- true if whitespaces are honoured when printing simple text nodes
-
setPreserveWhitespace
public void setPreserveWhitespace(boolean preserveWhitespace)Deprecated.Enable and/or disable preservation of whitespace.- Parameters:
preserveWhitespace- the new desired value
-
getQuote
Deprecated.Get Quote to use when printing attributes.- Returns:
- the quote character
-
setQuote
Deprecated.Set Quote to use when printing attributes.- Parameters:
quote- the quote character
-
isExpandEmptyElements
public boolean isExpandEmptyElements()Deprecated.Whether empty elements are expanded from <tagName/> to <tagName></tagName>.- Returns:
true, if empty elements will be represented by an opening tag followed immediately by a closing tag.
-
setExpandEmptyElements
public void setExpandEmptyElements(boolean expandEmptyElements)Deprecated.Whether empty elements are expanded from <tagName/> to <tagName></tagName>.- Parameters:
expandEmptyElements- iftrue, empty elements will be represented by an opening tag followed immediately by a closing tag. Defaults tofalse.
-
print
Deprecated. -
printLineBegin
protected void printLineBegin()Deprecated. -
printLineEnd
protected void printLineEnd()Deprecated. -
printLineEnd
Deprecated. -
printList
Deprecated. -
printSimpleItem
Deprecated. -
printName
protected void printName(groovy.util.Node node, XmlNodePrinter.NamespaceContext ctx, boolean begin, boolean preserve)Deprecated. -
printSpecialNode
protected boolean printSpecialNode(groovy.util.Node node)Deprecated. -
printNamespace
Deprecated. -
printNameAttributes
Deprecated.
-