Package org.apache.xml.serializer
Class TreeWalker
java.lang.Object
org.apache.xml.serializer.TreeWalker
public final class TreeWalker extends Object
This class does a pre-order walk of the DOM tree, calling a ContentHandler
interface as it goes.
This class is a copy of the one in org.apache.xml.utils.
It exists to cut the serializers dependancy on that package.
-
Field Summary
Fields Modifier and Type Field Description protected DOM2Helperm_dhDomHelper for this TreeWalker -
Constructor Summary
Constructors Constructor Description TreeWalker(ContentHandler ch)TreeWalker(ContentHandler contentHandler, String systemId)Constructor. -
Method Summary
Modifier and Type Method Description protected voidendNode(Node node)End processing of given nodeContentHandlergetContentHandler()Get the ContentHandler used for the tree walk.protected voidstartNode(Node node)Start processing given nodevoidtraverse(Node pos)Perform a pre-order traversal non-recursive style.voidtraverse(Node pos, Node top)Perform a pre-order traversal non-recursive style.
-
Field Details
-
m_dh
DomHelper for this TreeWalker
-
-
Constructor Details
-
TreeWalker
-
TreeWalker
Constructor.- Parameters:
contentHandler- The implemention of the contentHandler operation (toXMLString, digest, ...)
-
-
Method Details
-
getContentHandler
Get the ContentHandler used for the tree walk.- Returns:
- the ContentHandler used for the tree walk
-
traverse
Perform a pre-order traversal non-recursive style. Note that TreeWalker assumes that the subtree is intended to represent a complete (though not necessarily well-formed) document and, during a traversal, startDocument and endDocument will always be issued to the SAX listener.- Parameters:
pos- Node in the tree where to start traversal- Throws:
TransformerExceptionSAXException
-
traverse
Perform a pre-order traversal non-recursive style. Note that TreeWalker assumes that the subtree is intended to represent a complete (though not necessarily well-formed) document and, during a traversal, startDocument and endDocument will always be issued to the SAX listener.- Parameters:
pos- Node in the tree where to start traversaltop- Node in the tree where to end traversal- Throws:
TransformerExceptionSAXException
-
startNode
Start processing given node- Parameters:
node- Node to process- Throws:
SAXException
-
endNode
End processing of given node- Parameters:
node- Node we just finished processing- Throws:
SAXException
-