org.apache.xerces.dom
Class NodeIteratorImpl

java.lang.Object
  extended by org.apache.xerces.dom.NodeIteratorImpl
All Implemented Interfaces:
NodeIterator

public class NodeIteratorImpl
extends java.lang.Object
implements NodeIterator

DefaultNodeIterator implements a NodeIterator, which iterates a DOM tree in the expected depth first way.

The whatToShow and filter functionality is implemented as expected.

This class also has method removeNode to enable iterator "fix-up" on DOM remove. It is expected that the DOM implementation call removeNode right before the actual DOM transformation. If not called by the DOM, the client could call it before doing the removal.

Version:
$Id: NodeIteratorImpl.java 447266 2006-09-18 05:57:49Z mrglavas $

Constructor Summary
NodeIteratorImpl(DocumentImpl document, Node root, int whatToShow, NodeFilter nodeFilter, boolean entityReferenceExpansion)
          Public constructor
 
Method Summary
 void detach()
          Detaches the NodeIterator from the set which it iterated over, releasing any computational resources and placing the NodeIterator in the INVALID state.
 boolean getExpandEntityReferences()
          Return whether children entity references are included in the iterator.
 NodeFilter getFilter()
          Return the filter
 Node getRoot()
          The root node of the NodeIterator, as specified when it was created.
 int getWhatToShow()
          Return the whatToShow value
 Node nextNode()
          Return the next Node in the Iterator.
 Node previousNode()
          Return the previous Node in the Iterator.
 void removeNode(Node node)
          Fix-up the iterator on a remove.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeIteratorImpl

public NodeIteratorImpl(DocumentImpl document,
                        Node root,
                        int whatToShow,
                        NodeFilter nodeFilter,
                        boolean entityReferenceExpansion)
Public constructor

Method Detail

getRoot

public Node getRoot()
Description copied from interface: NodeIterator
The root node of the NodeIterator, as specified when it was created.

Specified by:
getRoot in interface NodeIterator

getWhatToShow

public int getWhatToShow()
Return the whatToShow value

Specified by:
getWhatToShow in interface NodeIterator

getFilter

public NodeFilter getFilter()
Return the filter

Specified by:
getFilter in interface NodeIterator

getExpandEntityReferences

public boolean getExpandEntityReferences()
Return whether children entity references are included in the iterator.

Specified by:
getExpandEntityReferences in interface NodeIterator

nextNode

public Node nextNode()
Return the next Node in the Iterator. The node is the next node in depth-first order which also passes the filter, and whatToShow. If there is no next node which passes these criteria, then return null.

Specified by:
nextNode in interface NodeIterator
Returns:
The next Node in the set being iterated over, or null if there are no more members in that set.

previousNode

public Node previousNode()
Return the previous Node in the Iterator. The node is the next node in _backwards_ depth-first order which also passes the filter, and whatToShow.

Specified by:
previousNode in interface NodeIterator
Returns:
The previous Node in the set being iterated over, or null if there are no more members in that set.

removeNode

public void removeNode(Node node)
Fix-up the iterator on a remove. Called by DOM or otherwise, before an actual DOM remove.


detach

public void detach()
Description copied from interface: NodeIterator
Detaches the NodeIterator from the set which it iterated over, releasing any computational resources and placing the NodeIterator in the INVALID state. After detach has been invoked, calls to nextNode or previousNode will raise the exception INVALID_STATE_ERR.

Specified by:
detach in interface NodeIterator