org.apache.batik.dom.traversal
Class DOMTreeWalker

java.lang.Object
  extended by org.apache.batik.dom.traversal.DOMTreeWalker
All Implemented Interfaces:
org.w3c.dom.traversal.TreeWalker

public class DOMTreeWalker
extends java.lang.Object
implements org.w3c.dom.traversal.TreeWalker

This class implements the NodeIterator interface.


Field Summary
protected  org.w3c.dom.Node currentNode
          The current node.
protected  boolean expandEntityReferences
          Whether the children of entity reference nodes are visible to the iterator.
protected  org.w3c.dom.traversal.NodeFilter filter
          The NodeFilter used to screen nodes.
protected  org.w3c.dom.Node root
          The root node.
protected  int whatToShow
          Which node types are presented via the iterator.
 
Constructor Summary
DOMTreeWalker(org.w3c.dom.Node n, int what, org.w3c.dom.traversal.NodeFilter nf, boolean exp)
          Creates a new TreeWalker object.
 
Method Summary
protected  short acceptNode(org.w3c.dom.Node n)
          Whether or not the given node is accepted by this tree walker.
 org.w3c.dom.Node firstChild()
          DOM: Implements TreeWalker.firstChild().
protected  org.w3c.dom.Node firstChild(org.w3c.dom.Node n)
          Returns the first child of the given node.
 org.w3c.dom.Node getCurrentNode()
          DOM: Implements TreeWalker.getCurrentNode().
 boolean getExpandEntityReferences()
          DOM: Implements TreeWalker.getExpandEntityReferences().
 org.w3c.dom.traversal.NodeFilter getFilter()
          DOM: Implements TreeWalker.getFilter().
 org.w3c.dom.Node getRoot()
          DOM: Implements TreeWalker.getRoot().
 int getWhatToShow()
          DOM: Implements TreeWalker.getWhatToShow().
 org.w3c.dom.Node lastChild()
          DOM: Implements TreeWalker.lastChild().
protected  org.w3c.dom.Node lastChild(org.w3c.dom.Node n)
          Returns the last child of the given node.
 org.w3c.dom.Node nextNode()
          DOM: Implements TreeWalker.nextNode().
 org.w3c.dom.Node nextSibling()
          DOM: Implements TreeWalker.nextSibling().
protected  org.w3c.dom.Node nextSibling(org.w3c.dom.Node n, org.w3c.dom.Node root)
          Returns the next sibling of the given node.
 org.w3c.dom.Node parentNode()
          DOM: Implements TreeWalker.parentNode().
protected  org.w3c.dom.Node parentNode(org.w3c.dom.Node n)
          Returns the parent node of the given node.
 org.w3c.dom.Node previousNode()
          DOM: Implements TreeWalker.previousNode().
 org.w3c.dom.Node previousSibling()
          DOM: Implements TreeWalker.previousSibling().
protected  org.w3c.dom.Node previousSibling(org.w3c.dom.Node n, org.w3c.dom.Node root)
          Returns the previous sibling of the given node.
 void setCurrentNode(org.w3c.dom.Node n)
          DOM: Implements TreeWalker.setCurrentNode(Node).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

protected org.w3c.dom.Node root
The root node.


whatToShow

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


filter

protected org.w3c.dom.traversal.NodeFilter filter
The NodeFilter used to screen nodes.


expandEntityReferences

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


currentNode

protected org.w3c.dom.Node currentNode
The current node.

Constructor Detail

DOMTreeWalker

public DOMTreeWalker(org.w3c.dom.Node n,
                     int what,
                     org.w3c.dom.traversal.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

getRoot

public org.w3c.dom.Node getRoot()
DOM: Implements TreeWalker.getRoot().

Specified by:
getRoot in interface org.w3c.dom.traversal.TreeWalker

getWhatToShow

public int getWhatToShow()
DOM: Implements TreeWalker.getWhatToShow().

Specified by:
getWhatToShow in interface org.w3c.dom.traversal.TreeWalker

getFilter

public org.w3c.dom.traversal.NodeFilter getFilter()
DOM: Implements TreeWalker.getFilter().

Specified by:
getFilter in interface org.w3c.dom.traversal.TreeWalker

getExpandEntityReferences

public boolean getExpandEntityReferences()
DOM: Implements TreeWalker.getExpandEntityReferences().

Specified by:
getExpandEntityReferences in interface org.w3c.dom.traversal.TreeWalker

getCurrentNode

public org.w3c.dom.Node getCurrentNode()
DOM: Implements TreeWalker.getCurrentNode().

Specified by:
getCurrentNode in interface org.w3c.dom.traversal.TreeWalker

setCurrentNode

public void setCurrentNode(org.w3c.dom.Node n)
DOM: Implements TreeWalker.setCurrentNode(Node).

Specified by:
setCurrentNode in interface org.w3c.dom.traversal.TreeWalker

parentNode

public org.w3c.dom.Node parentNode()
DOM: Implements TreeWalker.parentNode().

Specified by:
parentNode in interface org.w3c.dom.traversal.TreeWalker

firstChild

public org.w3c.dom.Node firstChild()
DOM: Implements TreeWalker.firstChild().

Specified by:
firstChild in interface org.w3c.dom.traversal.TreeWalker

lastChild

public org.w3c.dom.Node lastChild()
DOM: Implements TreeWalker.lastChild().

Specified by:
lastChild in interface org.w3c.dom.traversal.TreeWalker

previousSibling

public org.w3c.dom.Node previousSibling()
DOM: Implements TreeWalker.previousSibling().

Specified by:
previousSibling in interface org.w3c.dom.traversal.TreeWalker

nextSibling

public org.w3c.dom.Node nextSibling()
DOM: Implements TreeWalker.nextSibling().

Specified by:
nextSibling in interface org.w3c.dom.traversal.TreeWalker

previousNode

public org.w3c.dom.Node previousNode()
DOM: Implements TreeWalker.previousNode().

Specified by:
previousNode in interface org.w3c.dom.traversal.TreeWalker

nextNode

public org.w3c.dom.Node nextNode()
DOM: Implements TreeWalker.nextNode().

Specified by:
nextNode in interface org.w3c.dom.traversal.TreeWalker

parentNode

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


firstChild

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


lastChild

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


previousSibling

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


nextSibling

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


acceptNode

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



Copyright ? 2008 Apache Software Foundation. All Rights Reserved.