org.apache.xpath.axes

Class DescendantIterator

public class DescendantIterator extends LocPathIterator

This class implements an optimized iterator for descendant, descendant-or-self, or "//foo" patterns.

See Also: LocPathIterator

UNKNOWN: advanced

Constructor Summary
DescendantIterator()
Create a DescendantIterator object.
Method Summary
intasNode(XPathContext xctxt)
Return the first node out of the nodeset, if this expression is a nodeset expression.
DTMIteratorcloneWithReset()
Get a cloned Iterator that is reset to the beginning of the query.
booleandeepEquals(Expression expr)
voiddetach()
Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.
intgetAxis()
Returns the axis being iterated, if it is known.
intnextNode()
Returns the next node in the set and advances the position of the iterator in the set.
voidsetRoot(int context, Object environment)
Initialize the context values for this expression after it is cloned.

Constructor Detail

DescendantIterator

public DescendantIterator()
Create a DescendantIterator object.

Method Detail

asNode

public int asNode(XPathContext xctxt)
Return the first node out of the nodeset, if this expression is a nodeset expression. This is the default implementation for nodesets.

WARNING: Do not mutate this class from this function!

Parameters: xctxt The XPath runtime context.

Returns: the first node out of the nodeset, or DTM.NULL.

cloneWithReset

public DTMIterator cloneWithReset()
Get a cloned Iterator that is reset to the beginning of the query.

Returns: A cloned NodeIterator set of the start of the query.

Throws: CloneNotSupportedException

deepEquals

public boolean deepEquals(Expression expr)

See Also: deepEquals

detach

public void detach()
Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state. Afterdetach has been invoked, calls to nextNode orpreviousNode will raise the exception INVALID_STATE_ERR.

getAxis

public int getAxis()
Returns the axis being iterated, if it is known.

Returns: Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.

nextNode

public int nextNode()
Returns the next node in the set and advances the position of the iterator in the set. After a NodeIterator is created, the first call to nextNode() returns the first node in the set.

Returns: The next Node in the set being iterated over, or null if there are no more members in that set.

Throws: DOMException INVALID_STATE_ERR: Raised if this method is called after the detach method was invoked.

setRoot

public void setRoot(int context, Object environment)
Initialize the context values for this expression after it is cloned.

Parameters: context The XPath runtime context for this transformation.

Copyright B) 2006 Apache XML Project. All Rights Reserved.