org.apache.xpath.axes
Class LocPathIterator

java.lang.Object
  |
  +--org.apache.xpath.Expression
        |
        +--org.apache.xpath.axes.LocPathIterator
Direct Known Subclasses:
IndexedLocPathIterator, KeyIterator

public class LocPathIterator
extends Expression
implements java.lang.Cloneable, NodeIterator, ContextNodeList, NodeList

**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
 java.util.Vector m_waiting
          **For advanced use only**  
 
Constructor Summary
LocPathIterator(Compiler compiler, int opPos)
          **For advanced use only** Create a LocPathIterator object.
LocPathIterator(Compiler compiler, int opPos, boolean isMatchPattern)
          **For advanced use only** Create a LocPathIterator object (for match patterns.
LocPathIterator(PrefixResolver nscontext)
          **For advanced use only** Create a LocPathIterator object.
 
Method Summary
 void addToWaitList(AxesWalker walker)
          **For advanced use only**  
 java.lang.Object clone()
          **For advanced use only** Get a cloned LocPathIterator.
 NodeIterator cloneWithReset()
          **For advanced use only** Get a cloned Iterator.
 void detach()
          **For advanced use only** 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)
          **For advanced use only**  
 Node getContext()
          **For advanced use only**  
 Node getCurrentContextNode()
          **For advanced use only**  
 Node getCurrentNode()
          **For advanced use only** Return the last fetched node.
 int getCurrentPos()
          **For advanced use only** Get the current position, which is one less than the next nextNode() call will retreave.
 DOMHelper getDOMHelper()
          **For advanced use only**  
 boolean getExpandEntityReferences()
          **For advanced use only** The value of this flag determines whether the children of entity reference nodes are visible to the iterator.
 NodeFilter getFilter()
          **For advanced use only** The filter used to screen nodes.
 AxesWalker getFirstWalker()
          **For advanced use only** For internal use.
 boolean getFoundLast()
          **For advanced use only** Tells if we've found the last node yet.
 AxesWalker getLastUsedWalker()
          **For advanced use only** For internal use.
 int getLength()
          **For advanced use only** The number of nodes in the list.
 PrefixResolver getPrefixResolver()
          **For advanced use only** Return the saved reference to the prefix resolver that was in effect when this iterator was created.
 Node getRoot()
          **For advanced use only** The root node of the Iterator, as specified when it was created.
 int getStackFrameIndex()
          **For advanced use only**  
 int getWhatToShow()
          **For advanced use only** This attribute determines which node types are presented via the iterator.
 XPathContext getXPathContext()
          **For advanced use only**  
 void initContext(XPathContext execContext)
          **For advanced use only**  
 boolean isFresh()
          **For advanced use only** 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)
          **For advanced use only** Returns the index th item in the collection.
 Node nextNode()
          **For advanced use only** Returns the next node in the set and advances the position of the iterator in the set.
 Node previousNode()
          **For advanced use only** 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**  
 void reset()
          **For advanced use only** Reset the iterator.
 void runTo(int index)
          **For advanced use only** If an index is requested, NodeSet will call this method to run the iterator to the index.
 void setCurrentContextNode(Node n)
          **For advanced use only**  
 void setCurrentPos(int i)
          **For advanced use only** Set the current position in the node set.
 void setLastUsedWalker(AxesWalker walker)
          **For advanced use only** For internal use.
 void setShouldCacheNodes(boolean b)
          **For advanced use only** If setShouldCacheNodes(true) is called, then nodes will be cached.
 int size()
          **For advanced use only** Get the length of the list.
 
Methods inherited from class org.apache.xpath.Expression
assert, error, warn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_waiting

public java.util.Vector m_waiting
Constructor Detail

LocPathIterator

public LocPathIterator(PrefixResolver nscontext)
**For advanced use only** Create a LocPathIterator object.

LocPathIterator

public LocPathIterator(Compiler compiler,
                       int opPos)
                throws SAXException
**For advanced use only** Create a LocPathIterator object.

LocPathIterator

public LocPathIterator(Compiler compiler,
                       int opPos,
                       boolean isMatchPattern)
                throws SAXException
**For advanced use only** Create a LocPathIterator object (for match patterns.
Method Detail

execute

public XObject execute(XPathContext xctxt)
                throws SAXException
Overrides:
execute in class Expression

initContext

public void initContext(XPathContext execContext)

getCurrentPos

public int getCurrentPos()
**For advanced use only** Get the current position, which is one less than the next nextNode() call will retreave. i.e. if you call getCurrentPos() and the return is 0, the next fetch will take place at index 1.
Specified by:
getCurrentPos in interface ContextNodeList

setShouldCacheNodes

public void setShouldCacheNodes(boolean b)
**For advanced use only** If setShouldCacheNodes(true) is called, then nodes will be cached. They are not cached by default.
Specified by:
setShouldCacheNodes in interface ContextNodeList

setCurrentPos

public void setCurrentPos(int i)
**For advanced use only** Set the current position in the node set.
Specified by:
setCurrentPos in interface ContextNodeList
Parameters:
i - Must be a valid index.

size

public int size()
**For advanced use only** Get the length of the list.
Specified by:
size in interface ContextNodeList

item

public Node item(int index)
**For advanced use only** Returns the index th item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null .
Specified by:
item in interface NodeList
Parameters:
index - Index into the collection.
Returns:
The node at the index th position in the NodeList , or null if that is not a valid index.

getLength

public int getLength()
**For advanced use only** The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.
Specified by:
getLength in interface NodeList

isFresh

public boolean isFresh()
**For advanced use only** Tells if this NodeSet is "fresh", in other words, if the first nextNode() that is called will return the first node in the set.
Specified by:
isFresh in interface ContextNodeList

previousNode

public Node previousNode()
                  throws DOMException
**For advanced use only** Returns the previous node in the set and moves the position of the iterator backwards in the set.
Specified by:
previousNode in interface NodeIterator
Returns:
The previous Node in the set being iterated over, ornull 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.

getWhatToShow

public int getWhatToShow()
**For advanced use only** This attribute determines which node types are presented via the iterator. The available set of constants is defined in the NodeFilter interface.
Specified by:
getWhatToShow in interface NodeIterator

getFilter

public NodeFilter getFilter()
**For advanced use only** The filter used to screen nodes.
Specified by:
getFilter in interface NodeIterator

getRoot

public Node getRoot()
**For advanced use only** The root node of the Iterator, as specified when it was created.
Specified by:
getRoot in interface NodeIterator

getExpandEntityReferences

public boolean getExpandEntityReferences()
**For advanced use only** The value of this flag determines whether the children of entity reference nodes are visible to the iterator. If false, they will be skipped over.
To produce a view of the document that has entity references expanded and does not expose the entity reference node itself, use the whatToShow flags to hide the entity reference node and set expandEntityReferences to true when creating the iterator. To produce a view of the document that has entity reference nodes but no entity expansion, use the whatToShow flags to show the entity reference node and set expandEntityReferences to false.
Specified by:
getExpandEntityReferences in interface NodeIterator

detach

public void detach()
**For advanced use only** 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.
Specified by:
detach in interface NodeIterator

cloneWithReset

public NodeIterator cloneWithReset()
                            throws java.lang.CloneNotSupportedException
**For advanced use only** Get a cloned Iterator.
Specified by:
cloneWithReset in interface ContextNodeList

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
**For advanced use only** Get a cloned LocPathIterator.
Specified by:
clone in interface ContextNodeList

reset

public void reset()
**For advanced use only** Reset the iterator.
Specified by:
reset in interface ContextNodeList

nextNode

public Node nextNode()
              throws DOMException
**For advanced use only** 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.
Specified by:
nextNode in interface NodeIterator
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.

getCurrentNode

public Node getCurrentNode()
**For advanced use only** Return the last fetched node. Needed to support the UnionPathIterator.
Specified by:
getCurrentNode in interface ContextNodeList

runTo

public void runTo(int index)
**For advanced use only** If an index is requested, NodeSet will call this method to run the iterator to the index. By default this sets m_next to the index. If the index argument is -1, this signals that the iterator should be run to the end.
Specified by:
runTo in interface ContextNodeList

getFirstWalker

public AxesWalker getFirstWalker()
**For advanced use only** For internal use.

setLastUsedWalker

public void setLastUsedWalker(AxesWalker walker)
**For advanced use only** For internal use.

getLastUsedWalker

public AxesWalker getLastUsedWalker()
**For advanced use only** For internal use.

addToWaitList

public void addToWaitList(AxesWalker walker)

removeFromWaitList

public void removeFromWaitList(AxesWalker walker)

getFoundLast

public boolean getFoundLast()
**For advanced use only** Tells if we've found the last node yet.

getXPathContext

public XPathContext getXPathContext()

getDOMHelper

public DOMHelper getDOMHelper()

getContext

public Node getContext()

getStackFrameIndex

public int getStackFrameIndex()

getCurrentContextNode

public Node getCurrentContextNode()

setCurrentContextNode

public void setCurrentContextNode(Node n)

getPrefixResolver

public PrefixResolver getPrefixResolver()
**For advanced use only** Return the saved reference to the prefix resolver that was in effect when this iterator was created.


Copyright © 2000 Apache XML Project. All Rights Reserved.