| java.lang.Object org.apache.xml.dtm.DTMAxisTraverser
DTMAxisTraverser | abstract public class DTMAxisTraverser (Code) | | 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 ... }
author: Scott Boag |
Method 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. | 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. | abstract public int | next(int context, int current) Traverse to the next node after the current node.
Parameters: context - The context node of this traversal. | abstract public 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.
Parameters: context - The context node of this traversal. |
first | public int first(int context)(Code) | | 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>
Parameters: context - The context node of this traversal. This is the pointthat the traversal starts from. the first node in the traversal. |
first | public int first(int context, int extendedTypeID)(Code) | | 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>
Parameters: context - The context node of this traversal. This is the pointof origin for the traversal -- its "root node" or starting point. Parameters: extendedTypeID - The extended type ID that must match. the first node in the traversal. |
next | abstract public int next(int context, int current)(Code) | | Traverse to the next node after the current node.
Parameters: context - The context node of this traversal. This is the pointof origin for the traversal -- its "root node" or starting point. Parameters: current - The current node of the traversal. This is the last knownlocation in the traversal, typically the node-handle returned by theprevious traversal step. For the first traversal step, contextshould be set equal to current. Note that in order to test whethercontext is in the set, you must use the first() method instead. the next node in the iteration, or DTM.NULL. See Also: DTMAxisTraverser.first(int) |
next | abstract public int next(int context, int current, int extendedTypeID)(Code) | | Traverse to the next node after the current node that is matched
by the extended type ID.
Parameters: context - The context node of this traversal. This is the pointof origin for the traversal -- its "root node" or starting point. Parameters: current - The current node of the traversal. This is the last knownlocation in the traversal, typically the node-handle returned by theprevious traversal step. For the first traversal step, contextshould be set equal to current. Note that in order to test whethercontext is in the set, you must use the first() method instead. Parameters: extendedTypeID - The extended type ID that must match. the next node in the iteration, or DTM.NULL. See Also: DTMAxisTraverser.first(int,int) |
|
|