Top Description Fields Constructors Methods
org.apache.xerces.dom

public Class NodeIteratorImpl

extends Object
implements NodeIterator
Class Inheritance
All Implemented Interfaces
org.w3c.dom.traversal.NodeIterator
Imports
org.w3c.dom.DOMException, .Node, org.w3c.dom.traversal.NodeFilter, .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 $

Field Summary

Modifier and TypeField and Description
private Node
fCurrentNode

The last Node returned.

private boolean
fDetach

If detach is called, the fDetach flag is true, otherwise flase.

private DocumentImpl
fDocument

The DocumentImpl which created this iterator, so it can be detached.

private boolean
fEntityReferenceExpansion

When TRUE, the children of entites references are returned in the iterator.

private boolean
fForward

The direction of the iterator on the fCurrentNode.

private NodeFilter
fNodeFilter

The NodeFilter reference.

private Node
fRoot

The root.

private int
fWhatToShow

The whatToShow mask.

Constructor Summary

AccessConstructor and Description
public
NodeIteratorImpl(DocumentImpl document, Node root, int whatToShow, NodeFilter nodeFilter, boolean entityReferenceExpansion)

Public constructor

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
acceptNode(Node node)

The node is accepted if it passes the whatToShow and the filter.

public void
detach()

Implements org.w3c.dom.traversal.NodeIterator.detach.

Detaches the NodeIterator from the set which it iterated over, releasing any computational resources and placing the NodeIterator in the INVALID state.
public boolean
getExpandEntityReferences()

Implements org.w3c.dom.traversal.NodeIterator.getExpandEntityReferences.

Return whether children entity references are included in the iterator.
public NodeFilter
public Node
getRoot()

Implements org.w3c.dom.traversal.NodeIterator.getRoot.

The root node of the NodeIterator, as specified when it was created.
public int
getWhatToShow()

Implements org.w3c.dom.traversal.NodeIterator.getWhatToShow.

Return the whatToShow value
pack-priv Node
matchNodeOrParent(Node node)

Return node, if matches or any parent if matches.

public Node
nextNode()

Implements org.w3c.dom.traversal.NodeIterator.nextNode.

Return the next Node in the Iterator.
pack-priv Node
nextNode(Node node, boolean visitChildren)

The method nextNode(Node, boolean) returns the next node from the actual DOM tree.

public Node
previousNode()

Implements org.w3c.dom.traversal.NodeIterator.previousNode.

Return the previous Node in the Iterator.
pack-priv Node
previousNode(Node node)

The method previousNode(Node) returns the previous node from the actual DOM tree.

public void
removeNode(Node node)

Fix-up the iterator on a remove.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fCurrentNodeback to summary
private Node fCurrentNode

The last Node returned.

fDetachback to summary
private boolean fDetach

If detach is called, the fDetach flag is true, otherwise flase.

fDocumentback to summary
private DocumentImpl fDocument

The DocumentImpl which created this iterator, so it can be detached.

fEntityReferenceExpansionback to summary
private boolean fEntityReferenceExpansion

When TRUE, the children of entites references are returned in the iterator.

fForwardback to summary
private boolean fForward

The direction of the iterator on the fCurrentNode.

nextNode()  ==      fForward = true;
previousNode() ==   fForward = false;
fNodeFilterback to summary
private NodeFilter fNodeFilter

The NodeFilter reference.

fRootback to summary
private Node fRoot

The root.

fWhatToShowback to summary
private int fWhatToShow

The whatToShow mask.

Constructor Detail

NodeIteratorImplback to summary
public NodeIteratorImpl(DocumentImpl document, Node root, int whatToShow, NodeFilter nodeFilter, boolean entityReferenceExpansion)

Public constructor

Method Detail

acceptNodeback to summary
pack-priv boolean acceptNode(Node node)

The node is accepted if it passes the whatToShow and the filter.

detachback to summary
public void detach()

Implements org.w3c.dom.traversal.NodeIterator.detach.

Doc from org.w3c.dom.traversal.NodeIterator.detach.

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.

getExpandEntityReferencesback to summary
public boolean getExpandEntityReferences()

Implements org.w3c.dom.traversal.NodeIterator.getExpandEntityReferences.

Return whether children entity references are included in the iterator.

getFilterback to summary
public NodeFilter getFilter()

Implements org.w3c.dom.traversal.NodeIterator.getFilter.

Return the filter

getRootback to summary
public Node getRoot()

Implements org.w3c.dom.traversal.NodeIterator.getRoot.

Doc from org.w3c.dom.traversal.NodeIterator.getRoot.

The root node of the NodeIterator, as specified when it was created.

getWhatToShowback to summary
public int getWhatToShow()

Implements org.w3c.dom.traversal.NodeIterator.getWhatToShow.

Return the whatToShow value

matchNodeOrParentback to summary
pack-priv Node matchNodeOrParent(Node node)

Return node, if matches or any parent if matches.

nextNodeback to summary
public Node nextNode()

Implements org.w3c.dom.traversal.NodeIterator.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.

Returns:Node

Doc from org.w3c.dom.traversal.NodeIterator.nextNode.

The next Node in the set being iterated over, or null if there are no more members in that set.

nextNodeback to summary
pack-priv Node nextNode(Node node, boolean visitChildren)

The method nextNode(Node, boolean) returns the next node from the actual DOM tree. The boolean visitChildren determines whether to visit the children. The result is the nextNode.

previousNodeback to summary
public Node previousNode()

Implements org.w3c.dom.traversal.NodeIterator.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.

Returns:Node

Doc from org.w3c.dom.traversal.NodeIterator.previousNode.

The previous Node in the set being iterated over, or null if there are no more members in that set.

previousNodeback to summary
pack-priv Node previousNode(Node node)

The method previousNode(Node) returns the previous node from the actual DOM tree.

removeNodeback to summary
public void removeNode(Node node)

Fix-up the iterator on a remove. Called by DOM or otherwise, before an actual DOM remove.