APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.dtm.ref

public Class DTMTreeWalker

extends Object
Class Inheritance
Imports
com.sun.org.apache.xml.internal.dtm.DTM, com.sun.org.apache.xml.internal.utils.NodeConsumer, .XMLString, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler

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

Modifier and TypeField and Description
private ContentHandler
m_contentHandler

Local reference to a ContentHandler

protected DTM
m_dtm

DomHelper for this TreeWalker

pack-priv boolean
nextIsRaw

Flag indicating whether following text to be processed is raw text

Constructor Summary

AccessConstructor and Description
public
DTMTreeWalker()

Constructor.

public
DTMTreeWalker(ContentHandler
The implemention of the contentHandler operation (toXMLString, digest, ...)
contentHandler
,
DTM dtm)

Constructor.

Method Summary

Modifier and TypeMethod and Description
private final void
dispatachChars(int node)

Optimized dispatch of characters.

protected void
endNode(int
Node we just finished processing
node
)

End processing of given node

public ContentHandler

Returns:

the ContentHandler used for the tree walk
getcontentHandler
()

Get the ContentHandler used for the tree walk.

public void
setcontentHandler(ContentHandler
the ContentHandler to be the result of the tree walk.
ch
)

Set the ContentHandler used for the tree walk.

public void
setDTM(DTM
The Document Table Model to be used.
dtm
)

Set the DTM to be traversed.

protected void
startNode(int
Node to process
node
)

Start processing given node

public void
traverse(int
Node in the tree at which to start (and end) traversal -- in other words, the root of the subtree to traverse over.
pos
)

Perform a non-recursive pre-order/post-order traversal, operating as a Visitor.

public void
traverse(int
Node in the tree where to start traversal
pos
,
int
Node in the tree where to end traversal. If top==DTM.NULL, run through end of document.
top
)

Perform a non-recursive pre-order/post-order traversal, operating as a Visitor.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

m_contentHandlerback to summary
private ContentHandler m_contentHandler

Local reference to a ContentHandler

m_dtmback to summary
protected DTM m_dtm

DomHelper for this TreeWalker

nextIsRawback to summary
pack-priv boolean nextIsRaw

Flag indicating whether following text to be processed is raw text

Constructor Detail

DTMTreeWalkerback to summary
public DTMTreeWalker()

Constructor.

DTMTreeWalkerback to summary
public DTMTreeWalker(ContentHandler contentHandler, DTM dtm)

Constructor.

Parameters
contentHandler:ContentHandler

The implemention of the contentHandler operation (toXMLString, digest, ...)

Method Detail

dispatachCharsback to summary
private final void dispatachChars(int node) throws SAXException

Optimized dispatch of characters.

endNodeback to summary
protected void endNode(int node) throws SAXException

End processing of given node

Parameters
node:int

Node we just finished processing

getcontentHandlerback to summary
public ContentHandler getcontentHandler()

Get the ContentHandler used for the tree walk.

Returns:ContentHandler

the ContentHandler used for the tree walk

setcontentHandlerback to summary
public void setcontentHandler(ContentHandler ch)

Set the ContentHandler used for the tree walk.

Parameters
ch:ContentHandler

the ContentHandler to be the result of the tree walk.

setDTMback to summary
public void setDTM(DTM dtm)

Set the DTM to be traversed.

Parameters
dtm:DTM

The Document Table Model to be used.

startNodeback to summary
protected void startNode(int node) throws SAXException

Start processing given node

Parameters
node:int

Node to process

traverseback to summary
public void traverse(int pos) throws SAXException

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.

Parameters
pos:int

Node in the tree at which to start (and end) traversal -- in other words, the root of the subtree to traverse over.

traverseback to summary
public void traverse(int pos, int top) throws SAXException

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.

Parameters
pos:int

Node in the tree where to start traversal

top:int

Node in the tree where to end traversal. If top==DTM.NULL, run through end of document.