DTMAxisTraverserpublic abstract class DTMAxisTraverser extends Object A class that implements traverses DTMAxisTraverser interface can traverse
a set of nodes, usually as defined by an XPath axis. It is different from
an iterator, because it does not need to hold state, and, in fact, must not
hold any iteration-based state. It is meant to be implemented as an inner
class of a DTM, and returned by the getAxisTraverser(final int axis)
function.
A DTMAxisTraverser can probably not traverse a reverse axis in
document order.
Typical usage:
for(int nodeHandle=myTraverser.first(myContext);
nodeHandle!=DTM.NULL;
nodeHandle=myTraverser.next(myContext,nodeHandle))
{ ... processing for node indicated by nodeHandle goes here ... }
|
Methods Summary |
---|
public int | first(int context)By the nature of the stateless traversal, the context node can not be
returned or the iteration will go into an infinate loop. So to traverse
an axis, the first function must be used to get the first node.
This method needs to be overloaded only by those axis that process
the self node. <\p>
return next(context, context);
| public int | first(int context, int extendedTypeID)By the nature of the stateless traversal, the context node can not be
returned or the iteration will go into an infinate loop. So to traverse
an axis, the first function must be used to get the first node.
This method needs to be overloaded only by those axis that process
the self node. <\p>
return next(context, context, extendedTypeID);
| public abstract int | next(int context, int current)Traverse to the next node after the current node.
| public abstract int | next(int context, int current, int extendedTypeID)Traverse to the next node after the current node that is matched
by the extended type ID.
|
|