org.jaxen.dom

Class DocumentNavigator.NodeIterator

Enclosing Class:
DocumentNavigator
Implemented Interfaces:
Iterator

(package private) abstract class DocumentNavigator.NodeIterator
extends java.lang.Object
implements Iterator

A generic iterator over DOM nodes.

Concrete subclasses must implement the getFirstNode(Node) and getNextNode(Node) methods for a specific iteration strategy.

Field Summary

private Node
node

Constructor Summary

NodeIterator(Node contextNode)
Constructor.

Method Summary

protected abstract Node
getFirstNode(Node contextNode)
Get the first node for iteration.
protected abstract Node
getNextNode(Node contextNode)
Get the next node for iteration.
boolean
hasNext()
private boolean
isXPathNode(Node node)
Test whether a DOM node is usable by XPath.
Object
next()
void
remove()

Field Details

node

private Node node

Constructor Details

NodeIterator

public NodeIterator(Node contextNode)
Constructor.
Parameters:
contextNode - the starting node

Method Details

getFirstNode

protected abstract Node getFirstNode(Node contextNode)
Get the first node for iteration.

This method must derive an initial node for iteration from a context node.

Parameters:
contextNode - the starting node
Returns:
the first node in the iteration

getNextNode

protected abstract Node getNextNode(Node contextNode)
Get the next node for iteration.

This method must locate a following node from the current context node.

Parameters:
contextNode - the current node in the iteration
Returns:
the following node in the iteration, or null if there is none

hasNext

public boolean hasNext()

isXPathNode

private boolean isXPathNode(Node node)
Test whether a DOM node is usable by XPath.
Parameters:
node - the DOM node to test
Returns:
true if the node is usable, false if it should be skipped

next

public Object next()

remove

public void remove()