Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.utils

public Class TreeWalker

extends Object
Class Inheritance
Imports
com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler, javax.xml.transform.Result, org.w3c.dom.Comment, .Element, .EntityReference, .NamedNodeMap, .Node, .ProcessingInstruction, .Text, org.xml.sax.ContentHandler, .Locator, org.xml.sax.ext.LexicalHandler, org.xml.sax.helpers.LocatorImpl

This class does a pre-order walk of the DOM tree, calling a ContentHandler interface as it goes.

Field Summary

Modifier and TypeField and Description
private ContentHandler
m_contentHandler

Local reference to a ContentHandler

private LocatorImpl
m_locator

Locator object for this TreeWalker

pack-priv boolean

Constructor Summary

AccessConstructor and Description
public
TreeWalker(ContentHandler
The implementation of the
contentHandler
,
String
System identifier for the document. contentHandler operation (toXMLString, digest, ...)
systemId
)

Constructor.

public
TreeWalker(ContentHandler
The implementation of the contentHandler operation (toXMLString, digest, ...)
contentHandler
)

Constructor.

Method Summary

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

Optimized dispatch of characters.

protected void
endNode(Node
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

Returns:

the ContentHandler used for the tree walk
setContentHandler
(ContentHandler ch)

Get the ContentHandler used for the tree walk.

protected void
startNode(Node
Node to process
node
)

Start processing given node

public void
traverse(Node
Node in the tree where to start traversal
pos
)

Perform a pre-order traversal non-recursive style.

public void
traverse(Node
Node in the tree where to start traversal
pos
,
Node
Node in the tree where to end traversal
top
)

Perform a pre-order traversal non-recursive style.

public void
traverseFragment(Node
Node in the tree where to start traversal
pos
)

Perform a pre-order traversal non-recursive style.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

m_contentHandlerback to summary
private ContentHandler m_contentHandler

Local reference to a ContentHandler

m_locatorback to summary
private LocatorImpl m_locator

Locator object for this TreeWalker

nextIsRawback to summary
pack-priv boolean nextIsRaw

Constructor Detail

TreeWalkerback to summary
public TreeWalker(ContentHandler contentHandler, String systemId)

Constructor.

Parameters
contentHandler:ContentHandler

The implementation of the

systemId:String

System identifier for the document. contentHandler operation (toXMLString, digest, ...)

TreeWalkerback to summary
public TreeWalker(ContentHandler contentHandler)

Constructor.

Parameters
contentHandler:ContentHandler

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

Method Detail

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

Optimized dispatch of characters.

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

End processing of given node

Parameters
node:Node

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)

Get the ContentHandler used for the tree walk.

Returns:void

the ContentHandler used for the tree walk

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

Start processing given node

Parameters
node:Node

Node to process

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

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

Node in the tree where to start traversal

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

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

Node in the tree where to start traversal

top:Node

Node in the tree where to end traversal

traverseFragmentback to summary
public void traverseFragment(Node pos) throws SAXException

Perform a pre-order traversal non-recursive style. In contrast to the traverse() method this method will not issue startDocument() and endDocument() events to the SAX listener.

Parameters
pos:Node

Node in the tree where to start traversal