org.apache.xpath.axes

Class MatchPatternIterator

public class MatchPatternIterator extends LocPathIterator

This class treats a LocationPath as a filtered iteration over the tree, evaluating each node in a super axis traversal against the LocationPath interpreted as a match pattern. This class is useful to find nodes in document order that are complex paths whose steps probably criss-cross each other.
Method Summary
shortacceptNode(int n, XPathContext xctxt)
Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator.
voiddetach()
Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.
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.

Method Detail

acceptNode

public short acceptNode(int n, XPathContext xctxt)
Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator. This function will be called by the implementation of TreeWalker and NodeIterator; it is not intended to be called directly from user code.

Parameters: n The node to check to see if it passes the filter or not.

Returns: a constant to determine whether the node is accepted, rejected, or skipped, as defined above .

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.

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.

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.