|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.dtm.ref.DTMTreeWalker
This class does a pre-order walk of the DTM tree, calling a ContentHandler interface as it goes. As such, it's more like the Visitor design pattern than like the DOM's TreeWalker. I think normally this class should not be needed, because of DTM#dispatchToEvents.
Field Summary | |
private org.xml.sax.ContentHandler |
m_contentHandler
Local reference to a ContentHandler |
protected DTM |
m_dtm
DomHelper for this TreeWalker |
(package private) boolean |
nextIsRaw
Flag indicating whether following text to be processed is raw text |
Constructor Summary | |
DTMTreeWalker()
Constructor. |
|
DTMTreeWalker(org.xml.sax.ContentHandler contentHandler,
DTM dtm)
Constructor. |
Method Summary | |
private void |
dispatachChars(int node)
Optimized dispatch of characters. |
protected void |
endNode(int node)
End processing of given node |
org.xml.sax.ContentHandler |
getcontentHandler()
Get the ContentHandler used for the tree walk. |
void |
setcontentHandler(org.xml.sax.ContentHandler ch)
Set the ContentHandler used for the tree walk. |
void |
setDTM(DTM dtm)
Set the DTM to be traversed. |
protected void |
startNode(int node)
Start processing given node |
void |
traverse(int pos)
Perform a non-recursive pre-order/post-order traversal, operating as a Visitor. startNode (preorder) and endNode (postorder) are invoked for each node as we traverse over them, with the result that the node is written out to m_contentHandler. |
void |
traverse(int pos,
int top)
Perform a non-recursive pre-order/post-order traversal, operating as a Visitor. startNode (preorder) and endNode (postorder) are invoked for each node as we traverse over them, with the result that the node is written out to m_contentHandler. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.xml.sax.ContentHandler m_contentHandler
protected DTM m_dtm
boolean nextIsRaw
Constructor Detail |
public DTMTreeWalker()
public DTMTreeWalker(org.xml.sax.ContentHandler contentHandler, DTM dtm)
contentHandler
- The implemention of the
contentHandler operation (toXMLString, digest, ...)Method Detail |
public void setDTM(DTM dtm)
dtm
- The Document Table Model to be used.public org.xml.sax.ContentHandler getcontentHandler()
public void setcontentHandler(org.xml.sax.ContentHandler ch)
ch
- the ContentHandler to be the result of the tree walk.public void traverse(int pos) throws org.xml.sax.SAXException
pos
- Node in the tree at which to start (and end) traversal --
in other words, the root of the subtree to traverse over.
TransformerException
org.xml.sax.SAXException
public void traverse(int pos, int top) throws org.xml.sax.SAXException
pos
- Node in the tree where to start traversaltop
- Node in the tree where to end traversal.
If top==DTM.NULL, run through end of document.
TransformerException
org.xml.sax.SAXException
private final void dispatachChars(int node) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void startNode(int node) throws org.xml.sax.SAXException
node
- Node to process
org.xml.sax.SAXException
protected void endNode(int node) throws org.xml.sax.SAXException
node
- Node we just finished processing
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |