org.apache.batik.dom.traversal

Class DOMTreeWalker

public class DOMTreeWalker extends Object implements TreeWalker

This class implements the {@link org.w3c.dom.traversal.NodeIterator} interface.
Field Summary
protected NodecurrentNode
The current node.
protected booleanexpandEntityReferences
Whether the children of entity reference nodes are visible to the iterator.
protected NodeFilterfilter
The NodeFilter used to screen nodes.
protected Noderoot
The root node.
protected intwhatToShow
Which node types are presented via the iterator.
Constructor Summary
DOMTreeWalker(Node n, int what, NodeFilter nf, boolean exp)
Creates a new TreeWalker object.
Method Summary
protected shortacceptNode(Node n)
Whether or not the given node is accepted by this tree walker.
NodefirstChild()
DOM: Implements {@link TreeWalker#firstChild()}.
protected NodefirstChild(Node n)
Returns the first child of the given node.
NodegetCurrentNode()
DOM: Implements {@link TreeWalker#getCurrentNode()}.
booleangetExpandEntityReferences()
DOM: Implements {@link TreeWalker#getExpandEntityReferences()}.
NodeFiltergetFilter()
DOM: Implements {@link TreeWalker#getFilter()}.
NodegetRoot()
DOM: Implements {@link TreeWalker#getRoot()}.
intgetWhatToShow()
DOM: Implements {@link TreeWalker#getWhatToShow()}.
NodelastChild()
DOM: Implements {@link TreeWalker#lastChild()}.
protected NodelastChild(Node n)
Returns the last child of the given node.
NodenextNode()
DOM: Implements {@link TreeWalker#nextNode()}.
NodenextSibling()
DOM: Implements {@link TreeWalker#nextSibling()}.
protected NodenextSibling(Node n, Node root)
Returns the next sibling of the given node.
NodeparentNode()
DOM: Implements {@link TreeWalker#parentNode()}.
protected NodeparentNode(Node n)
Returns the parent node of the given node.
NodepreviousNode()
DOM: Implements {@link TreeWalker#previousNode()}.
NodepreviousSibling()
DOM: Implements {@link TreeWalker#previousSibling()}.
protected NodepreviousSibling(Node n, Node root)
Returns the previous sibling of the given node.
voidsetCurrentNode(Node n)
DOM: Implements {@link TreeWalker#setCurrentNode(Node)}.

Field Detail

currentNode

protected Node currentNode
The current node.

expandEntityReferences

protected boolean expandEntityReferences
Whether the children of entity reference nodes are visible to the iterator.

filter

protected NodeFilter filter
The NodeFilter used to screen nodes.

root

protected Node root
The root node.

whatToShow

protected int whatToShow
Which node types are presented via the iterator.

Constructor Detail

DOMTreeWalker

public DOMTreeWalker(Node n, int what, NodeFilter nf, boolean exp)
Creates a new TreeWalker object.

Parameters: n The root node. what Which node types are presented via the iterator. nf The NodeFilter used to screen nodes. exp Whether the children of entity reference nodes are visible to the tree walker.

Method Detail

acceptNode

protected short acceptNode(Node n)
Whether or not the given node is accepted by this tree walker.

firstChild

public Node firstChild()
DOM: Implements {@link TreeWalker#firstChild()}.

firstChild

protected Node firstChild(Node n)
Returns the first child of the given node.

getCurrentNode

public Node getCurrentNode()
DOM: Implements {@link TreeWalker#getCurrentNode()}.

getExpandEntityReferences

public boolean getExpandEntityReferences()
DOM: Implements {@link TreeWalker#getExpandEntityReferences()}.

getFilter

public NodeFilter getFilter()
DOM: Implements {@link TreeWalker#getFilter()}.

getRoot

public Node getRoot()
DOM: Implements {@link TreeWalker#getRoot()}.

getWhatToShow

public int getWhatToShow()
DOM: Implements {@link TreeWalker#getWhatToShow()}.

lastChild

public Node lastChild()
DOM: Implements {@link TreeWalker#lastChild()}.

lastChild

protected Node lastChild(Node n)
Returns the last child of the given node.

nextNode

public Node nextNode()
DOM: Implements {@link TreeWalker#nextNode()}.

nextSibling

public Node nextSibling()
DOM: Implements {@link TreeWalker#nextSibling()}.

nextSibling

protected Node nextSibling(Node n, Node root)
Returns the next sibling of the given node.

parentNode

public Node parentNode()
DOM: Implements {@link TreeWalker#parentNode()}.

parentNode

protected Node parentNode(Node n)
Returns the parent node of the given node.

previousNode

public Node previousNode()
DOM: Implements {@link TreeWalker#previousNode()}.

previousSibling

public Node previousSibling()
DOM: Implements {@link TreeWalker#previousSibling()}.

previousSibling

protected Node previousSibling(Node n, Node root)
Returns the previous sibling of the given node.

setCurrentNode

public void setCurrentNode(Node n)
DOM: Implements {@link TreeWalker#setCurrentNode(Node)}.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.