public class NodeListIterator extends Object implements Iterator<Node>
NodeList
that provides full iterator
behavior. See NodeListIterable
if all
you want to do is use the NodeList in a JDK 1.5 for
loop.
Because a NodeList
is a view on a DOM tree, this iterator has
slightly different semantics than a typical java.util
iterator.
First, it is not "fail fast": the DOM consists of independent nodes, and we
have no way to track when changes to the DOM may have made the nodelist
invalid.
Second, and more important, removal via the iterator changes the DOM, not just the underlying list.
Constructor and Description |
---|
NodeListIterator(NodeList nodelist)
Creates an iterator that returns all nodes from the passed list.
|
NodeListIterator(NodeList nodelist,
Class<?> klass)
Creates an iterator that returns only the nodes of a specific class
from the passed list.
|
public NodeListIterator(NodeList nodelist)