APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xpath.internal.axes

public abstract Class LocPathIterator

extends PredicatedNodeTest
implements Cloneable, DTMIterator, Serializable, PathComponent
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.xpath.internal.axes.PathComponent, java.io.Serializable, com.sun.org.apache.xml.internal.dtm.DTMIterator, java.lang.Cloneable
Known Direct Subclasses
com.sun.org.apache.xpath.internal.axes.MatchPatternIterator, com.sun.org.apache.xpath.internal.axes.SelfIteratorNoPredicate, com.sun.org.apache.xpath.internal.axes.UnionPathIterator, com.sun.org.apache.xpath.internal.axes.WalkingIterator, com.sun.org.apache.xpath.internal.axes.BasicTestIterator, com.sun.org.apache.xpath.internal.axes.ChildIterator, com.sun.org.apache.xpath.internal.axes.DescendantIterator, com.sun.org.apache.xpath.internal.axes.FilterExprIteratorSimple
Imports
com.sun.org.apache.xalan.internal.res.XSLMessages, com.sun.org.apache.xml.internal.dtm.DTM, .DTMFilter, .DTMIterator, .DTMManager, com.sun.org.apache.xml.internal.utils.PrefixResolver, com.sun.org.apache.xpath.internal.ExpressionOwner, .XPathContext, .XPathVisitor, com.sun.org.apache.xpath.internal.compiler.Compiler, com.sun.org.apache.xpath.internal.objects.XNodeSet, .XObject, com.sun.org.apache.xpath.internal.res.XPATHErrorResources

This class extends NodeSetDTM, which implements NodeIterator, and fetches nodes one at a time in document order based on a XPath LocationPath.

If setShouldCacheNodes(true) is called, as each node is iterated via nextNode(), the node is also stored in the NodeVector, so that previousNode() can easily be done, except in the case where the LocPathIterator is "owned" by a UnionPathIterator, in which case the UnionPathIterator will cache the nodes.

Field Summary

Modifier and TypeField and Description
protected boolean
m_allowDetach

Control over whether it is OK for detach to reset the iterator.

protected transient DTM
m_cdtm

The dtm of the context node.

protected transient IteratorPool
m_clones

The pool for cloned iterators.

protected transient int
m_context

The context node for this iterator, which doesn't change through the course of the iteration.

protected transient int
m_currentContextNode

The node context from where the expression is being executed from (i.e. for current() support).

protected transient XPathContext
m_execContext

The XPathContext reference, needed for execution of many operations.

private boolean
m_isTopLevel

Value determined at compile time, indicates that this is an iterator at the top level of the expression, rather than inside a predicate.

public transient int
m_lastFetched

The last node that was fetched, usually by nextNode.

protected transient int
protected transient int
m_pos

The current position of the context node.

private PrefixResolver
m_prefixResolver

Fast access to the current prefix resolver.

pack-priv transient int
m_stackFrame

The stack frame index for this iterator.

pack-priv static final long
Inherited from com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest:
DEBUG_PREDICATECOUNTINGm_foundLastm_lpim_predCountm_predicateIndexm_proximityPositions

Constructor Summary

AccessConstructor and Description
protected
LocPathIterator()

Create a LocPathIterator object.

protected
LocPathIterator(PrefixResolver
The namespace context for this iterator, should be OK if null.
nscontext
)

Create a LocPathIterator object.

protected
LocPathIterator(Compiler
The Compiler which is creating this expression.
compiler
,
int
The position of this iterator in the opcode list from the compiler.
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.

protected
LocPathIterator(Compiler
The Compiler which is creating this expression.
compiler
,
int
The position of this iterator in the opcode list from the compiler.
opPos
,
int analysis, boolean
True if walkers should be loaded, or false if this is a derived iterator and it doesn't wish to load child walkers.
shouldLoadWalkers
)

Create a LocPathIterator object, including creation of step walkers from the opcode list, and call back into the Compiler to create predicate expressions.

Method Summary

Modifier and TypeMethod and Description
public void
allowDetachToRelease(boolean
true if it is OK for detach to release this iterator for pooling.
allowRelease
)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.allowDetachToRelease.

Specify if it's OK for detach to release the iterator for reuse.

public DTMIterator
asIterator(XPathContext
The execution context.
xctxt
,
int
The node that "." expresses.
contextNode
)

Overrides com.sun.org.apache.xpath.internal.Expression.asIterator.

Given an select expression and a context, evaluate the XPath and return the resulting iterator.

public int

Returns:

the first node out of the nodeset, or DTM.NULL.
asNode
(XPathContext
The XPath runtime context.
xctxt
)

Overrides com.sun.org.apache.xpath.internal.Expression.asNode.

Return the first node out of the nodeset, if this expression is a nodeset expression.

public boolean

Returns:

The result of the operation as a boolean.
bool
(XPathContext
The runtime execution context.
xctxt
)

Overrides com.sun.org.apache.xpath.internal.Expression.bool.

Evaluate this operation directly to a boolean.

public void
callVisitors(ExpressionOwner owner, XPathVisitor visitor)

Overrides com.sun.org.apache.xpath.internal.patterns.NodeTest.callVisitors.

Implements com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

This will traverse the heararchy, calling the visitor for each member.

public DTMIterator

Returns:

A cloned NodeIterator set of the start of the query.
cloneWithReset
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.cloneWithReset.

Get a cloned Iterator that is reset to the beginning of the query.

public void
detach()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.detach.

Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.

public XObject

Returns:

An XNodeSet reference that holds this iterator.
execute
(XPathContext
The XPath execution context.
xctxt
)

Overrides com.sun.org.apache.xpath.internal.patterns.NodeTest.execute.

Execute this iterator, meaning create a clone that can store state, and initialize it for fast execution from the current runtime state.

public void

Returns:

The result of the expression in the form of a XObject.
executeCharsToContentHandler
(XPathContext
The XPath runtime context.
xctxt
,
ContentHandler
The target content handler.
handler
)

Overrides com.sun.org.apache.xpath.internal.Expression.executeCharsToContentHandler.

Execute an expression in the XPath runtime context, and return the result of the expression.

public int

Returns:

One of WalkerFactory#BIT_DESCENDANT, etc.
getAnalysisBits
()

Implements com.sun.org.apache.xpath.internal.axes.PathComponent.getAnalysisBits.

Get the analysis bits for this walker, as defined in the WalkerFactory.

public int

Returns:

Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.
getAxis
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getAxis.

Returns the axis being iterated, if it is known.

public final int

Returns:

The node context, same as getRoot().
getContext
()

The node context for the iterator.

public final int

Returns:

The top-level node context of the entire expression.
getCurrentContextNode
()

The node context from where the expression is being executed from (i.e. for current() support).

public int

Returns:

The last fetched node, or null if the last fetch was null.
getCurrentNode
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getCurrentNode.

Return the last fetched node.

public final int

Returns:

A value greater than or equal to zero that indicates the next node position to fetch.
getCurrentPos
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getCurrentPos.

Get the current position, which is one less than the next nextNode() call will retrieve.

public DTM

Returns:

a non-null DTM reference.
getDTM
(int
the nodeHandle.
nodeHandle
)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getDTM.

Get an instance of a DTM that "owns" a node handle.

public DTMManager

Returns:

a non-null DTMManager reference.
getDTMManager
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getDTMManager.

Get an instance of the DTMManager.

public boolean

Returns:

Always true, since entity reference nodes are not visible in the XPath model.
getExpandEntityReferences
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getExpandEntityReferences.

The value of this flag determines whether the children of entity reference nodes are visible to the iterator.

public DTMFilter

Returns:

Always null.
getFilter
()

The filter used to screen nodes.

public final boolean

Returns:

true if the last nextNode returned null.
getFoundLast
()

Tells if we've found the last node yet.

public boolean

Returns:

true if this location path is at the top level of the expression.
getIsTopLevel
()

Get if this is an iterator at the upper level of the XPath.

public int
public int

Returns:

The number of nodes in the list, always greater or equal to zero.
getLength
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getLength.

The number of nodes in the list.

public final PrefixResolver

Returns:

The prefix resolver or this iterator, which may be null.
getPrefixResolver
()

Return the saved reference to the prefix resolver that was in effect when this iterator was created.

public int

Returns:

The "root" of this iterator, which, in XPath terms, is the node context for this iterator.
getRoot
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getRoot.

The root node of the Iterator, as specified when it was created.

public int

Returns:

For now, always NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE.
getWhatToShow
()

Overrides com.sun.org.apache.xpath.internal.patterns.NodeTest.getWhatToShow.

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getWhatToShow.

This attribute determines which node types are presented via the iterator.

public final XPathContext

Returns:

XPath execution context this iterator is operating on, or null if setRoot has not been called.
getXPathContext
()

The XPath execution context we are operating on.

public void
incrementCurrentPos()

Increment the current position in the node set.

public boolean

Returns:

true as a default.
isDocOrdered
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.isDocOrdered.

Returns true if all the nodes in the iteration well be returned in document order.

public boolean

Returns:

true of nextNode has not been called.
isFresh
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.isFresh.

Tells if this NodeSetDTM is "fresh", in other words, if the first nextNode() that is called will return the first node in the set.

public boolean

Returns:

True if the nodelist can be mutated.
isMutable
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.isMutable.

Tells if this iterator can have nodes added to it or set via the setItem(int node, int index) method.

public boolean

Returns:

true if the expression can be represented as a nodeset.
isNodesetExpr
()

Overrides com.sun.org.apache.xpath.internal.Expression.isNodesetExpr.

Tell if the expression is a nodeset expression.

public int

Returns:

The node at the index th position in the NodeList , or null if that is not a valid index.
item
(int
Index into the collection.
index
)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.item.

Returns the index th item in the collection.

public abstract int

Returns:

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

Redeclares com.sun.org.apache.xml.internal.dtm.DTMIterator.nextNode.

Returns the next node in the set and advances the position of the iterator in the set.

public int

Returns:

The previous Node in the set being iterated over, ornull if there are no more members in that set.
previousNode
()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.previousNode.

Returns the previous node in the set and moves the position of the iterator backwards in the set.

private void
readObject(ObjectInputStream
Input stream to read from
stream
)

Hides com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.readObject.

Read the object from a serialization stream.

public void
protected int

Returns:

The same node that was passed as an argument.
returnNextNode
(int
The next node found, may be null.
nextNode
)

Bottleneck the return of a next node, to make returns easier from nextNode().

public void
runTo(int
The index to run to, or -1 if the iterator should run to the end.
index
)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.runTo.

If an index is requested, NodeSetDTM will call this method to run the iterator to the index.

public final void
setCurrentContextNode(int
Must be a non-null reference to the node context.
n
)

Set the current context node for this iterator.

public void
setCurrentPos(int
Must be a valid index greater than or equal to zero and less than m_cachedNodes.size().
i
)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.setCurrentPos.

Set the current position in the node set.

public void
setEnvironment(Object
The environment object.
environment
)

Set the environment in which this iterator operates, which should provide: a node (the context node...

public void
setIsTopLevel(boolean
true if this location path is at the top level of the expression.
b
)

Set if this is an iterator at the upper level of the XPath.

public void
setItem(int
Node to set
node
,
int
Index of where to set the node
index
)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.setItem.

Sets the node at the specified index of this vector to be the specified node.

protected void
setNextPosition(int
A value greater than or equal to zero that indicates the next node position to fetch.
next
)

Set the next position index of this iterator.

public void
setRoot(int
The XPath runtime context for this transformation.
context
,
Object environment)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.setRoot.

Initialize the context values for this expression after it is cloned.

public void
setShouldCacheNodes(boolean
True if this iterator should cache nodes.
b
)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.setShouldCacheNodes.

If setShouldCacheNodes(true) is called, then nodes will be cached.

public int

Returns:

The size of the current cache list.
size
()

Get the length of the cached nodes.

Inherited from com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest:
acceptNodecallPredicateVisitorscanTraverseOutsideSubtreeclonecountProximityPositiondeepEqualsexecutePredicatesfixupVariablesgetLocPathIteratorgetPredicategetPredicateCountgetPredicateIndexgetProximityPositiongetProximityPositiongetProximityPositioninitPredicateInfoinitProximityPositionisReverseAxesnodeToStringresetProximityPositionssetLocPathIteratorsetPredicateCount

Field Detail

m_allowDetachback to summary
protected boolean m_allowDetach

Control over whether it is OK for detach to reset the iterator.

m_cdtmback to summary
protected transient DTM m_cdtm

The dtm of the context node. Careful about using this... it may not be the dtm of the current node.

m_clonesback to summary
protected transient IteratorPool m_clones

The pool for cloned iterators. Iterators need to be cloned because the hold running state, and thus the original iterator expression from the stylesheet pool can not be used.

m_contextback to summary
protected transient int m_context

The context node for this iterator, which doesn't change through the course of the iteration.

m_currentContextNodeback to summary
protected transient int m_currentContextNode

The node context from where the expression is being executed from (i.e. for current() support). Different from m_context in that this is the context for the entire expression, rather than the context for the subexpression.

m_execContextback to summary
protected transient XPathContext m_execContext

The XPathContext reference, needed for execution of many operations.

m_isTopLevelback to summary
private boolean m_isTopLevel

Value determined at compile time, indicates that this is an iterator at the top level of the expression, rather than inside a predicate.

m_lastFetchedback to summary
public transient int m_lastFetched

The last node that was fetched, usually by nextNode.

m_lengthback to summary
protected transient int m_length
m_posback to summary
protected transient int m_pos

The current position of the context node.

m_prefixResolverback to summary
private PrefixResolver m_prefixResolver

Fast access to the current prefix resolver. It isn't really clear that this is needed.

Annotations
@SuppressWarnings:serial
m_stackFrameback to summary
pack-priv transient int m_stackFrame

The stack frame index for this iterator.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.serialVersionUID.

Constructor Detail

LocPathIteratorback to summary
protected LocPathIterator()

Create a LocPathIterator object.

LocPathIteratorback to summary
protected LocPathIterator(PrefixResolver nscontext)

Create a LocPathIterator object.

Parameters
nscontext:PrefixResolver

The namespace context for this iterator, should be OK if null.

LocPathIteratorback to summary
protected LocPathIterator(Compiler compiler, int opPos, int analysis) throws TransformerException

Create a LocPathIterator object, including creation of step walkers from the opcode list, and call back into the Compiler to create predicate expressions.

Parameters
compiler:Compiler

The Compiler which is creating this expression.

opPos:int

The position of this iterator in the opcode list from the compiler.

LocPathIteratorback to summary
protected LocPathIterator(Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers) throws TransformerException

Create a LocPathIterator object, including creation of step walkers from the opcode list, and call back into the Compiler to create predicate expressions.

Parameters
compiler:Compiler

The Compiler which is creating this expression.

opPos:int

The position of this iterator in the opcode list from the compiler.

shouldLoadWalkers:boolean

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

allowDetachToReleaseback to summary
public void allowDetachToRelease(boolean allowRelease)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.allowDetachToRelease.

Specify if it's OK for detach to release the iterator for reuse.

Parameters
allowRelease:boolean

true if it is OK for detach to release this iterator for pooling.

asIteratorback to summary
public DTMIterator asIterator(XPathContext xctxt, int contextNode) throws TransformerException

Overrides com.sun.org.apache.xpath.internal.Expression.asIterator.

Given an select expression and a context, evaluate the XPath and return the resulting iterator.

Parameters
xctxt:XPathContext

The execution context.

contextNode:int

The node that "." expresses.

Exceptions
TransformerException:
thrown if the active ProblemListener decides the error condition is severe enough to halt processing.
asNodeback to summary
public int asNode(XPathContext xctxt) throws TransformerException

Overrides com.sun.org.apache.xpath.internal.Expression.asNode.

Return the first node out of the nodeset, if this expression is a nodeset expression. This is the default implementation for nodesets. Derived classes should try and override this and return a value without having to do a clone operation.

Parameters
xctxt:XPathContext

The XPath runtime context.

Returns:int

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

boolback to summary
public boolean bool(XPathContext xctxt) throws TransformerException

Overrides com.sun.org.apache.xpath.internal.Expression.bool.

Evaluate this operation directly to a boolean.

Parameters
xctxt:XPathContext

The runtime execution context.

Returns:boolean

The result of the operation as a boolean.

callVisitorsback to summary
public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)

Overrides com.sun.org.apache.xpath.internal.patterns.NodeTest.callVisitors.

Implements com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

Doc from com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.

See Also
com.sun.org.apache.xpath.internal.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor)
cloneWithResetback to summary
public DTMIterator cloneWithReset() throws CloneNotSupportedException

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.cloneWithReset.

Get a cloned Iterator that is reset to the beginning of the query.

Returns:DTMIterator

A cloned NodeIterator set of the start of the query.

detachback to summary
public void detach()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.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.

executeback to summary
public XObject execute(XPathContext xctxt) throws TransformerException

Overrides com.sun.org.apache.xpath.internal.patterns.NodeTest.execute.

Execute this iterator, meaning create a clone that can store state, and initialize it for fast execution from the current runtime state. When this is called, no actual query from the current context node is performed.

Parameters
xctxt:XPathContext

The XPath execution context.

Returns:XObject

An XNodeSet reference that holds this iterator.

Exceptions
TransformerException:

Doc from com.sun.org.apache.xpath.internal.Expression.execute.

if a runtime exception occurs.

executeCharsToContentHandlerback to summary
public void executeCharsToContentHandler(XPathContext xctxt, ContentHandler handler) throws TransformerException, SAXException

Overrides com.sun.org.apache.xpath.internal.Expression.executeCharsToContentHandler.

Execute an expression in the XPath runtime context, and return the result of the expression.

Parameters
xctxt:XPathContext

The XPath runtime context.

handler:ContentHandler

The target content handler.

Returns:void

The result of the expression in the form of a XObject.

Exceptions
TransformerException:
if a runtime exception occurs.
getAnalysisBitsback to summary
public int getAnalysisBits()

Implements com.sun.org.apache.xpath.internal.axes.PathComponent.getAnalysisBits.

Get the analysis bits for this walker, as defined in the WalkerFactory.

Returns:int

One of WalkerFactory#BIT_DESCENDANT, etc.

getAxisback to summary
public int getAxis()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getAxis.

Returns the axis being iterated, if it is known.

Returns:int

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

getContextback to summary
public final int getContext()

The node context for the iterator.

Returns:int

The node context, same as getRoot().

getCurrentContextNodeback to summary
public final int getCurrentContextNode()

The node context from where the expression is being executed from (i.e. for current() support).

Returns:int

The top-level node context of the entire expression.

getCurrentNodeback to summary
public int getCurrentNode()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getCurrentNode.

Return the last fetched node. Needed to support the UnionPathIterator.

Returns:int

The last fetched node, or null if the last fetch was null.

getCurrentPosback to summary
public final int getCurrentPos()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getCurrentPos.

Get the current position, which is one less than the next nextNode() call will retrieve. i.e. if you call getCurrentPos() and the return is 0, the next fetch will take place at index 1.

Returns:int

A value greater than or equal to zero that indicates the next node position to fetch.

getDTMback to summary
public DTM getDTM(int nodeHandle)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getDTM.

Get an instance of a DTM that "owns" a node handle. Since a node iterator may be passed without a DTMManager, this allows the caller to easily get the DTM using just the iterator.

Parameters
nodeHandle:int

the nodeHandle.

Returns:DTM

a non-null DTM reference.

getDTMManagerback to summary
public DTMManager getDTMManager()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getDTMManager.

Get an instance of the DTMManager. Since a node iterator may be passed without a DTMManager, this allows the caller to easily get the DTMManager using just the iterator.

Returns:DTMManager

a non-null DTMManager reference.

getExpandEntityReferencesback to summary
public boolean getExpandEntityReferences()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getExpandEntityReferences.

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.

Returns:boolean

Always true, since entity reference nodes are not visible in the XPath model.

getFilterback to summary
public DTMFilter getFilter()

The filter used to screen nodes. Not used at this time, this is here only to fullfill the DOM NodeIterator interface.

Returns:DTMFilter

Always null.

See Also
org.w3c.dom.traversal.NodeIterator
getFoundLastback to summary
public final boolean getFoundLast()

Tells if we've found the last node yet.

Returns:boolean

true if the last nextNode returned null.

getIsTopLevelback to summary
public boolean getIsTopLevel()

Get if this is an iterator at the upper level of the XPath.

Returns:boolean

true if this location path is at the top level of the expression.

getLastPosback to summary
public int getLastPos(XPathContext xctxt)

Implements abstract com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.getLastPos.

Implements com.sun.org.apache.xpath.internal.axes.SubContextList.getLastPos.

Doc from com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.getLastPos.

Get the index of the last node that can be itterated to.

See Also
PredicatedNodeTest#getLastPos(XPathContext)
getLengthback to summary
public int getLength()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getLength.

The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.

Returns:int

The number of nodes in the list, always greater or equal to zero.

getPrefixResolverback to summary
public final PrefixResolver getPrefixResolver()

Return the saved reference to the prefix resolver that was in effect when this iterator was created.

Returns:PrefixResolver

The prefix resolver or this iterator, which may be null.

getRootback to summary
public int getRoot()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getRoot.

The root node of the Iterator, as specified when it was created.

Returns:int

The "root" of this iterator, which, in XPath terms, is the node context for this iterator.

getWhatToShowback to summary
public int getWhatToShow()

Overrides com.sun.org.apache.xpath.internal.patterns.NodeTest.getWhatToShow.

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.getWhatToShow.

This attribute determines which node types are presented via the iterator. The available set of constants is defined in the 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.

Returns:int

For now, always NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE.

See Also
org.w3c.dom.traversal.NodeIterator
getXPathContextback to summary
public final XPathContext getXPathContext()

The XPath execution context we are operating on.

Returns:XPathContext

XPath execution context this iterator is operating on, or null if setRoot has not been called.

incrementCurrentPosback to summary
public void incrementCurrentPos()

Increment the current position in the node set.

isDocOrderedback to summary
public boolean isDocOrdered()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.isDocOrdered.

Returns true if all the nodes in the iteration well be returned in document order.

Returns:boolean

true as a default.

isFreshback to summary
public boolean isFresh()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.isFresh.

Tells if this NodeSetDTM is "fresh", in other words, if the first nextNode() that is called will return the first node in the set.

Returns:boolean

true of nextNode has not been called.

isMutableback to summary
public boolean isMutable()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.isMutable.

Tells if this iterator can have nodes added to it or set via the setItem(int node, int index) method.

Returns:boolean

True if the nodelist can be mutated.

isNodesetExprback to summary
public boolean isNodesetExpr()

Overrides com.sun.org.apache.xpath.internal.Expression.isNodesetExpr.

Tell if the expression is a nodeset expression.

Returns:boolean

true if the expression can be represented as a nodeset.

itemback to summary
public int item(int index)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.item.

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 .

Parameters
index:int

Index into the collection.

Returns:int

The node at the index th position in the NodeList , or null if that is not a valid index.

nextNodeback to summary
public abstract int nextNode()

Redeclares com.sun.org.apache.xml.internal.dtm.DTMIterator.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:int

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

previousNodeback to summary
public int previousNode()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.previousNode.

Returns the previous node in the set and moves the position of the iterator backwards in the set.

Returns:int

The previous Node in the set being iterated over, ornull if there are no more members in that set.

readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException

Hides com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.readObject.

Read the object from a serialization stream.

Parameters
stream:ObjectInputStream

Input stream to read from

Exceptions
IOException:
in case of any IO related exceptions
ClassNotFoundException:
if Class of the serialized object cannot be found
resetback to summary
public void reset()

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.reset.

Reset the iterator.

returnNextNodeback to summary
protected int returnNextNode(int nextNode)

Bottleneck the return of a next node, to make returns easier from nextNode().

Parameters
nextNode:int

The next node found, may be null.

Returns:int

The same node that was passed as an argument.

runToback to summary
public void runTo(int index)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.runTo.

If an index is requested, NodeSetDTM 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.

Parameters
index:int

The index to run to, or -1 if the iterator should run to the end.

setCurrentContextNodeback to summary
public final void setCurrentContextNode(int n)

Set the current context node for this iterator.

Parameters
n:int

Must be a non-null reference to the node context.

setCurrentPosback to summary
public void setCurrentPos(int i)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.setCurrentPos.

Set the current position in the node set.

Parameters
i:int

Must be a valid index greater than or equal to zero and less than m_cachedNodes.size().

setEnvironmentback to summary
public void setEnvironment(Object environment)

Set the environment in which this iterator operates, which should provide: a node (the context node... same value as "root" defined below) a pair of non-zero positive integers (the context position and the context size) a set of variable bindings a function library the set of namespace declarations in scope for the expression.

At this time the exact implementation of this environment is application dependent. Probably a proper interface will be created fairly soon.

Parameters
environment:Object

The environment object.

setIsTopLevelback to summary
public void setIsTopLevel(boolean b)

Set if this is an iterator at the upper level of the XPath.

Parameters
b:boolean

true if this location path is at the top level of the expression.

setItemback to summary
public void setItem(int node, int index)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.setItem.

Sets the node at the specified index of this vector to be the specified node. The previous component at that position is discarded.

The index must be a value greater than or equal to 0 and less than the current size of the vector. The iterator must be in cached mode.

Meant to be used for sorted iterators.

Parameters
node:int

Node to set

index:int

Index of where to set the node

setNextPositionback to summary
protected void setNextPosition(int next)

Set the next position index of this iterator.

Parameters
next:int

A value greater than or equal to zero that indicates the next node position to fetch.

setRootback to summary
public void setRoot(int context, Object environment)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.setRoot.

Initialize the context values for this expression after it is cloned.

Parameters
context:int

The XPath runtime context for this transformation.

setShouldCacheNodesback to summary
public void setShouldCacheNodes(boolean b)

Implements com.sun.org.apache.xml.internal.dtm.DTMIterator.setShouldCacheNodes.

If setShouldCacheNodes(true) is called, then nodes will be cached. They are not cached by default.

Parameters
b:boolean

True if this iterator should cache nodes.

sizeback to summary
public int size()

Get the length of the cached nodes.

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.

Returns:int

The size of the current cache list.