|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xpath.Expression | +--org.apache.xpath.patterns.NodeTest | +--org.apache.xpath.axes.PredicatedNodeTest | +--org.apache.xpath.axes.LocPathIterator
**For advanced use only**
This class extends NodeSet, which implements NodeIterator,
and fetches nodes one at a time in document order based on a XPath
Field Summary | |
Node |
m_lastFetched
The last node that was fetched, usually by nextNode. |
Fields inherited from class org.apache.xpath.patterns.NodeTest |
SCORE_NODETEST,
SCORE_NONE,
SCORE_NSWILD,
SCORE_OTHER,
SCORE_QNAME,
SHOW_BYFUNCTION,
SHOW_NAMESPACE,
SUPPORTS_PRE_STRIPPING,
WILD |
Constructor Summary | |
LocPathIterator(Compiler compiler,
int opPos,
int analysis)
Create a LocPathIterator object, including creation of step walkers from the opcode list, and call back into the Compiler to create predicate expressions. |
|
LocPathIterator(Compiler compiler,
int opPos,
int analysis,
boolean shouldLoadWalkers)
Create a LocPathIterator object, including creation of step walkers from the opcode list, and call back into the Compiler to create predicate expressions. |
|
LocPathIterator(PrefixResolver nscontext)
Create a LocPathIterator object. |
Method Summary | |
void |
addToWaitList(AxesWalker walker)
**For advanced use only** Add a walker to the waiting list. |
boolean |
canTraverseOutsideSubtree()
Tell if this expression or it's subexpressions can traverse outside the current subtree. |
java.lang.Object |
clone()
Get a cloned LocPathIterator that holds the same position as this iterator. |
NodeIterator |
cloneWithReset()
Get a cloned Iterator that is reset to the beginning of the query. |
void |
detach()
Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state. |
XObject |
execute(XPathContext xctxt)
Execute this iterator, meaning create a clone that can store state, and initialize it for fast execution from the current runtime state. |
NodeSet |
getCachedNodes()
Get cached nodes. |
Node |
getContext()
The node context for the iterator. |
Node |
getCurrentContextNode()
The node context from where the expression is being executed from (i.e. |
Node |
getCurrentNode()
Return the last fetched node. |
int |
getCurrentPos()
Get the current position, which is one less than the next nextNode() call will retrieve. |
DOMHelper |
getDOMHelper()
The DOM helper for the given context; |
boolean |
getExpandEntityReferences()
The value of this flag determines whether the children of entity reference nodes are visible to the iterator. |
NodeFilter |
getFilter()
The filter used to screen nodes. |
AxesWalker |
getFirstWalker()
**For advanced use only** Get the head of the walker list. |
boolean |
getFoundLast()
Tells if we've found the last node yet. |
boolean |
getIsTopLevel()
**For advanced use only** Get if this is an iterator at the upper level of the XPath. |
int |
getLast()
Get the index of the last node in the iteration. |
int |
getLastPos(XPathContext xctxt)
Get the index of the last node that can be itterated to. |
AxesWalker |
getLastUsedWalker()
**For advanced use only** Get the last used walker. |
int |
getLength()
The number of nodes in the list. |
PrefixResolver |
getPrefixResolver()
Return the saved reference to the prefix resolver that was in effect when this iterator was created. |
Node |
getRoot()
The root node of the Iterator, as specified when it was created. |
int |
getWhatToShow()
This attribute determines which node types are presented via the iterator. |
XPathContext |
getXPathContext()
The XPath execution context we are operating on. |
void |
initContext(XPathContext execContext)
Initialize the context values for this expression after it is cloned. |
boolean |
isFresh()
Tells if this NodeSet is "fresh", in other words, if the first nextNode() that is called will return the first node in the set. |
Node |
item(int index)
Returns the index th item in the collection. |
Node |
nextNode()
Returns the next node in the set and advances the position of the iterator in the set. |
Node |
previousNode()
Returns the previous node in the set and moves the position of the iterator backwards in the set. |
void |
removeFromWaitList(AxesWalker walker)
**For advanced use only** Remove a walker from the waiting list. |
void |
reset()
Reset the iterator. |
void |
runTo(int index)
If an index is requested, NodeSet will call this method to run the iterator to the index. |
void |
setCurrentContextNode(Node n)
Set the current context node for this iterator. |
void |
setCurrentPos(int i)
Set the current position in the node set. |
void |
setIsTopLevel(boolean b)
**For advanced use only** Set if this is an iterator at the upper level of the XPath. |
void |
setLast(int last)
Set the index of the last node in the iteration. |
void |
setLastUsedWalker(AxesWalker walker)
**For advanced use only** Set the last used walker. |
void |
setShouldCacheNodes(boolean b)
If setShouldCacheNodes(true) is called, then nodes will be cached. |
int |
size()
Get the length of the cached nodes. |
Methods inherited from class org.apache.xpath.axes.PredicatedNodeTest |
acceptNode,
getLocPathIterator,
getPredicateCount,
getPredicateIndex,
getProximityPosition,
getProximityPosition,
initProximityPosition,
isReverseAxes,
resetProximityPositions,
setLocPathIterator,
setPredicateCount |
Methods inherited from class org.apache.xpath.patterns.NodeTest |
debugWhatToShow,
execute,
getDefaultScore,
getLocalName,
getNamespace,
initNodeTest,
initNodeTest |
Methods inherited from class org.apache.xpath.Expression |
assert,
error,
setSourceLocator,
warn |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public transient Node m_lastFetched
Constructor Detail |
public LocPathIterator(PrefixResolver nscontext)
nscontext
- The namespace context for this iterator,
should be OK if null.public LocPathIterator(Compiler compiler, int opPos, int analysis) throws TransformerException
compiler
- The Compiler which is creating
this expression.opPos
- The position of this iterator in the
opcode list from the compiler.public LocPathIterator(Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers) throws TransformerException
compiler
- The Compiler which is creating
this expression.opPos
- The position of this iterator in the
opcode list from the compiler.shouldLoadWalkers
- True if walkers should be
loaded, or false if this is a derived iterator and
it doesn't wish to load child walkers.Method Detail |
public XObject execute(XPathContext xctxt) throws TransformerException
xctxt
- The XPath execution context.public void setIsTopLevel(boolean b)
b
- true if this location path is at the top level of the
expression.public boolean getIsTopLevel()
public void initContext(XPathContext execContext)
execContext
- The XPath runtime context for this
transformation.public final int getCurrentPos()
public void setShouldCacheNodes(boolean b)
b
- True if this iterator should cache nodes.public NodeSet getCachedNodes()
public void setCurrentPos(int i)
i
- Must be a valid index greater
than or equal to zero and less than m_cachedNodes.size().public int size()
Note: for the moment at least, this only returns the size of the nodes that have been fetched to date, it doesn't attempt to run to the end to make sure we have found everything. This should be reviewed.
public Node item(int index)
index
th item in the collection. If
index
is greater than or equal to the number of nodes in
the list, this returns null
.index
- Index into the collection.index
th position in the
NodeList
, or null
if that is not a valid
index.public int getLength()
length-1
inclusive.public boolean isFresh()
public Node previousNode() throws DOMException
Node
in the set being iterated over,
ornull
if there are no more members in that set.detach
method was invoked.public int getWhatToShow()
NodeFilter
interface.
This is somewhat useless at this time, since it doesn't really return information that tells what this iterator will show. It is here only to fullfill the DOM NodeIterator interface.
NodeIterator
public NodeFilter getFilter()
NodeIterator
public Node getRoot()
public boolean getExpandEntityReferences()
public void detach()
detach
has been invoked, calls to
nextNode
orpreviousNode
will raise the
exception INVALID_STATE_ERR.public NodeIterator cloneWithReset() throws java.lang.CloneNotSupportedException
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
public void reset()
public Node nextNode() throws DOMException
Node
in the set being iterated over, or
null
if there are no more members in that set.detach
method was invoked.public Node getCurrentNode()
public void runTo(int index)
index
- The index to run to, or -1 if the iterator
should run to the end.public final AxesWalker getFirstWalker()
public final void setLastUsedWalker(AxesWalker walker)
walker
- The last used walker, or null.public final AxesWalker getLastUsedWalker()
public final void addToWaitList(AxesWalker walker)
walker
- A walker that is waiting for
other step walkers to complete, before it can
continue.AxesWalker
public final void removeFromWaitList(AxesWalker walker)
walker
- A walker that is no longer waiting.AxesWalker
public final boolean getFoundLast()
public final XPathContext getXPathContext()
public final DOMHelper getDOMHelper()
public final Node getContext()
public final Node getCurrentContextNode()
public final void setCurrentContextNode(Node n)
n
- Must be a non-null reference to the node context.public final PrefixResolver getPrefixResolver()
public int getLast()
public void setLast(int last)
last
- the index of the last node in the iteration.public int getLastPos(XPathContext xctxt)
xctxt
- XPath runtime context.public boolean canTraverseOutsideSubtree()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |