- All Superinterfaces:
Iterator<Node>,ListIterator<Node>
Interoperability
This interface is based on the NodeIterator
interface in DOM Level 4, although behaviour does not exactly match:
Iterators implementing this interface are expected to skip full nodes
(descendants included) when the NodeFilter returns
NodeFilter.FILTER_SKIP_NODE_CHILD, while the W3C standard would
expect it to behave like NodeFilter.FILTER_SKIP
(which in this implementation is called NodeFilter.FILTER_SKIP_NODE),
and skip only the node itself.
Additionally, beware that this iterator also behaves differently from the
Xerces NodeIterator regarding attributes:
If the filtering done by the NodeFilter changes during the
traversal (that is, nodes that were previously accepted now aren't), the
behaviour of this iterator may become inconsistent when going backwards. In
that case, you may want to try a TreeWalker instead.
ListIterator optional operations: add,
set, remove
This library's iterator implements ListIterator and its optional
operations, but any attempts to remove the root node, to change
it with set (or to insert a node before it with
add) must fail.
-
Method Summary
Modifier and TypeMethodDescriptionGet theNodeFiltercallback.getRoot()The root node to iterate.intThe bitmask specifying what types of nodes to show.next()nextNode()The same asnext(), but avoids theNoSuchElementException.previous()The same asprevious(), but avoids theNoSuchElementException.Methods inherited from interface java.util.Iterator
forEachRemainingMethods inherited from interface java.util.ListIterator
add, hasNext, hasPrevious, nextIndex, previousIndex, remove, set
-
Method Details
-
getRoot
DOMNode getRoot()The root node to iterate.See the description of
rootin DOM Level 4.- Returns:
- the root node.
-
getWhatToShow
int getWhatToShow()The bitmask specifying what types of nodes to show.- Returns:
- the bitmask to control which types of nodes are returned by the iterator.
-
getNodeFilter
NodeFilter getNodeFilter()Get theNodeFiltercallback.See
NodeFilter.- Returns:
- a reference to the
NodeFiltercallback.
-
next
DOMNode next() -
nextNode
DOMNode nextNode()The same asnext(), but avoids theNoSuchElementException. Exists for compatibility with theNodeIteratorin DOM Level 4.- Returns:
- the next node, or
nullif there is no next node.
-
previous
DOMNode previous()- Specified by:
previousin interfaceListIterator<Node>
-
previousNode
DOMNode previousNode()The same asprevious(), but avoids theNoSuchElementException. Exists for compatibility with theNodeIteratorin DOM Level 4.- Returns:
- the previous node, or
nullif there is no previous node.
-