public final class NodeIteratorImpl extends Object implements org.w3c.dom.traversal.NodeIterator, NodeList
The iterator interface is defined by NodeIterator
. This class
serves as an adapter class that implements the interface and delegates
iteration requests to a inner iterator, and destroys the inner iterator
when garabage collected.
InnerIterator
contains the actual iteration logic. Changes
in the document tree are reported through the InnerIterator
interface and the iterator has to adjust accordingly. Two inner
iterators exist, one for list iteration the other for tree iteration.
ParentNodeImpl
creates the new iterator and registers it as a
listener to changes in the node's tree. The node obtains the listener
by calling asInnerIterator()
on the iterator. The iterator can
unregistered itself by calling ParentNodeImpl.removeInnerIterator(org.openxml.dom.traversal.InnerIterator)
on the node.
NodeIterator
,
InnerIterator
,
ParentNodeImpl
Constructor and Description |
---|
NodeIteratorImpl(ParentNodeImpl owner,
boolean tree,
int whatToShow,
org.w3c.dom.traversal.NodeFilter filter)
Constrctor for a new node iterator.
|
Modifier and Type | Method and Description |
---|---|
InnerIterator |
asInnerIterator()
Return the inner iterator.
|
void |
detach() |
boolean |
getExpandEntityReferences() |
org.w3c.dom.traversal.NodeFilter |
getFilter() |
int |
getLength()
Return the number of childs in this node.
|
Node |
getRoot() |
int |
getWhatToShow() |
Node |
item(int index)
Return the nth child in the node (zero based).
|
Node |
nextNode() |
Node |
previousNode() |
void |
setExpandEntityReferences(boolean expand) |
public NodeIteratorImpl(ParentNodeImpl owner, boolean tree, int whatToShow, org.w3c.dom.traversal.NodeFilter filter)
owner
- The owner of this iterator and top of the node List to iteratetree
- True if tree iterator required, false for list iteratorwhatToShow
- Flag indicating what nodes to returnfilter
- Optional node filterpublic Node nextNode()
nextNode
in interface org.w3c.dom.traversal.NodeIterator
public Node previousNode()
previousNode
in interface org.w3c.dom.traversal.NodeIterator
public final boolean getExpandEntityReferences()
getExpandEntityReferences
in interface org.w3c.dom.traversal.NodeIterator
public final void setExpandEntityReferences(boolean expand)
public final org.w3c.dom.traversal.NodeFilter getFilter()
getFilter
in interface org.w3c.dom.traversal.NodeIterator
public final int getWhatToShow()
getWhatToShow
in interface org.w3c.dom.traversal.NodeIterator
public InnerIterator asInnerIterator()
public Node item(int index)
public int getLength()
public void detach()
detach
in interface org.w3c.dom.traversal.NodeIterator
public Node getRoot()
getRoot
in interface org.w3c.dom.traversal.NodeIterator
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.