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

public final Class TreeWalker

extends Object
Class Inheritance
Imports
com.sun.org.apache.xml.internal.utils.AttList, .DOM2Helper, 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. This class is a copy of the one in com.sun.org.apache.xml.internal.utils. It exists to cut the serializers dependancy on that package.

Field Summary

Modifier and TypeField and Description
private final ContentHandler
m_contentHandler

Local reference to a ContentHandler

private final LocatorImpl
m_locator

Locator object for this TreeWalker

private final SerializationHandler
m_Serializer

If m_contentHandler is a SerializationHandler, then this is a reference to the same object.

pack-priv boolean

Constructor Summary

AccessConstructor and Description
public
public
TreeWalker(ContentHandler
The implemention of the contentHandler operation (toXMLString, digest, ...)
contentHandler
,
String systemId)

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.

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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

m_contentHandlerback to summary
private final ContentHandler m_contentHandler

Local reference to a ContentHandler

m_locatorback to summary
private final LocatorImpl m_locator

Locator object for this TreeWalker

m_Serializerback to summary
private final SerializationHandler m_Serializer

If m_contentHandler is a SerializationHandler, then this is a reference to the same object.

nextIsRawback to summary
pack-priv boolean nextIsRaw

Constructor Detail

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

Constructor.

Parameters
contentHandler:ContentHandler

The implemention 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

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