|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object th.co.edge.jseq.util.XMLUtil.NodePrinter
public static class XMLUtil.NodePrinter
An implementation of Visitor
that creates a string
representation of a Node
and its children, or in other
words, to a (part of) an XML document.
To use this class, create a new NodePrinter
instance, call
XMLUtil.traverse
using it, and then call the
toString
method on the NodePrinter
.
Constructor Summary | |
---|---|
XMLUtil.NodePrinter(boolean prettyPrint)
Creates a new NodePrinter . |
Method Summary | |
---|---|
void |
afterVisit(org.w3c.dom.Node node)
For an element node, adds the end tag for the given Node
to the string representation of the XML document, if necessary. |
java.lang.String |
toString()
Returns a string representation of the Node that has
been traversed using this NodePrinter , or the empty
string if the Node has not yet been traversed. |
boolean |
visit(org.w3c.dom.Node node)
Adds the string representation appropriate at the beginning of the given Node . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public XMLUtil.NodePrinter(boolean prettyPrint)
NodePrinter
.
prettyPrint
- if true
string representation of an XML
document will contain new-lines, with each sub-node
indentedMethod Detail |
---|
public boolean visit(org.w3c.dom.Node node)
Node
. For example, for an element node, this
would add the start tag with its attributes; for a document node,
this would add the DOCTYPE declaration, and so on.
visit
in interface XMLUtil.Visitor
node
- the Node
for which to generate a string
representation
false
, so as never to stop the traversalpublic void afterVisit(org.w3c.dom.Node node)
Node
to the string representation of the XML document, if necessary.
afterVisit
in interface XMLUtil.Visitor
node
- the Node
being visitedpublic java.lang.String toString()
Node
that has
been traversed using this NodePrinter
, or the empty
string if the Node
has not yet been traversed.
toString
in class java.lang.Object
Node
that has
been traversed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |