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

public Class XPathContext

extends DTMManager
Class Inheritance
Imports
com.sun.org.apache.xalan.internal.extensions.ExpressionContext, com.sun.org.apache.xalan.internal.res.XSLMessages, com.sun.org.apache.xml.internal.dtm.Axis, .DTM, .DTMFilter, .DTMIterator, .DTMManager, .DTMWSFilter, com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2RTFDTM, com.sun.org.apache.xml.internal.utils.IntStack, .NodeVector, .ObjectStack, .PrefixResolver, .XMLString, com.sun.org.apache.xpath.internal.axes.SubContextList, com.sun.org.apache.xpath.internal.objects.DTMXRTreeFrag, .XObject, .XString, com.sun.org.apache.xpath.internal.res.XPATHErrorResources, java.lang.reflect.Method, java.util.ArrayList, .HashMap, .Iterator, .List, .Map, .Stack, javax.xml.transform.ErrorListener, .SourceLocator, .URIResolver, org.xml.sax.XMLReader

Default class for the runtime execution context for XPath.

This class extends DTMManager but does not directly implement it.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class

Field Summary

Modifier and TypeField and Description
pack-priv XPathContext.XPathExpressionContext
private Stack<SubContextList>
m_axesIteratorStack

Stack of AxesIterators.

private Stack<DTMIterator>
m_contextNodeLists

The current context node list.

private IntStack
m_currentExpressionNodes

A stack of the current sub-expression nodes.

private IntStack
m_currentNodes

The stack of current node objects.

private ErrorListener
m_defaultErrorListener

A default ErrorListener in case our m_errorListener was not specified and our owner either does not have an ErrorListener or has a null one.

protected DTMManager
m_dtmManager

Though XPathContext context extends the DTMManager, it really is a proxy for this object, which is the real DTMManager.

private Map<Integer, DTMXRTreeFrag>
m_DTMXRTreeFrags

HashMap of cached the DTMXRTreeFrag objects, which are identified by DTM IDs.

private ErrorListener
m_errorListener

The ErrorListener where errors and warnings are to be reported.

private SAX2RTFDTM
m_global_rtfdtm

Most recent "reusable" DTM for Global Result Tree Fragments.

private boolean
m_isSecureProcessing

state of the secure processing feature.

private NodeVector
m_iteratorRoots

A stack of the current sub-expression nodes.

pack-priv IntStack
private boolean
private Object
m_owner

The owner context of this XPathContext.

private Method
m_ownerGetErrorListener

The owner context of this XPathContext.

private IntStack
private NodeVector
m_predicateRoots

A stack of the current sub-expression nodes.

private ObjectStack
public XMLReader
m_primaryReader

The reader of the primary source tree.

private List<DTM>
m_rtfdtm_stack

Stack of cached "reusable" DTMs for Result Tree Fragments.

pack-priv ObjectStack
m_saxLocations

The current stylesheet locator.

private URIResolver
m_uriResolver

The TrAX URI Resolver for resolving URIs from the document(...) function to source tree nodes.

private VariableStack
m_variableStacks

The stack of Variable stacks.

private int
m_which_rtfdtm

Index of currently active RTF DTM in m_rtfdtm_stack

public static final int
RECURSIONLIMIT

The amount to use for stacks that record information during the recursive execution.

Inherited from com.sun.org.apache.xml.internal.dtm.DTMManager:
IDENT_DTM_DEFAULTIDENT_DTM_NODE_BITSIDENT_MAX_DTMSIDENT_NODE_DEFAULTm_incrementalm_source_locationm_xsf

Constructor Summary

AccessConstructor and Description
public
XPathContext()

Create an XPathContext instance.

public
XPathContext(boolean overrideDefaultParser)

public
XPathContext(Object
Value that can be retrieved via the getOwnerObject() method.
owner
)

This constructor doesn't seem to be used anywhere -- huizhe wang** Create an XPathContext instance.

Method Summary

Modifier and TypeMethod and Description
public DTM

Returns:

A new DocumentFragment handle.
createDocumentFragment
()

Implements abstract com.sun.org.apache.xml.internal.dtm.DTMManager.createDocumentFragment.

Creates an empty DocumentFragment object.

public DTMIterator

Returns:

The newly created DTMIterator.
createDTMIterator
(Object
??? Somehow we need to pass in a subpart of the expression. I hate to do this with strings, since the larger expression has already been parsed.
xpathCompiler
,
int
The position in the expression.
pos
)

Implements abstract com.sun.org.apache.xml.internal.dtm.DTMManager.createDTMIterator.

Create a new DTMIterator based on an XPath LocationPath or a UnionExpr.

public DTMIterator

Returns:

The newly created DTMIterator.
createDTMIterator
(String
Must be a valid string expressing a LocationPath or a UnionExpr.
xpathString
,
PrefixResolver
An object that can resolve prefixes to namespace URLs.
presolver
)

Implements abstract com.sun.org.apache.xml.internal.dtm.DTMManager.createDTMIterator.

Create a new DTMIterator based on an XPath LocationPath or a UnionExpr.

public DTMIterator

Returns:

The newly created NodeIterator.
createDTMIterator
(int
This flag specifies which node types may appear in the logical view of the tree presented by the iterator. See the description of NodeFilter for the set of possible SHOW_ values.These flags can be combined using OR.
whatToShow
,
DTMFilter
The NodeFilter to be used with this TreeWalker, or null to indicate no filter.
filter
,
boolean
The value of this flag determines whether entity reference nodes are expanded.
entityReferenceExpansion
)

Implements abstract com.sun.org.apache.xml.internal.dtm.DTMManager.createDTMIterator.

Create a new DTMIterator based only on a whatToShow and a DTMFilter.

public DTMIterator

Returns:

The newly created DTMIterator.
createDTMIterator
(int
The node handle that the DTMIterator will iterate to.
node
)

Implements abstract com.sun.org.apache.xml.internal.dtm.DTMManager.createDTMIterator.

Create a new DTMIterator that holds exactly one node.

public Stack<SubContextList>
public final int

Returns:

The current context node.
getContextNode
()

Get the current context node.

public final DTMIterator

Returns:

the current node list, also referred to here as a context node list.
getContextNodeList
()

Get the current context node list.

public Stack<DTMIterator>
public final DTMIterator

Returns:

An iterator for the current context list, as defined in XSLT.
getContextNodes
()

Get the current context node list.

public final int

Returns:

The current sub-expression node.
getCurrentExpressionNode
()

Get the current node that is the expression's context (i.e. for current() support).

public IntStack
public final int

Returns:

the current node.
getCurrentNode
()

Get the current context node.

public SubContextList

Returns:

the current node list.
getCurrentNodeList
()

Get the current node list as defined by the XSLT spec.

public IntStack
public DTM

Returns:

a non-null DTM reference.
getDTM
(Source
the specification of the source object, which may be null, in which case it is assumed that node construction will take by some other means.
source
,
boolean
true if the returned DTM must be unique, probably because it is going to be mutated.
unique
,
DTMWSFilter
Enables filtering of whitespace nodes, and may be null.
wsfilter
,
boolean
true if the construction should try and be incremental.
incremental
,
boolean
true if the caller considers it worth it to use indexing schemes.
doIndexing
)

Implements abstract com.sun.org.apache.xml.internal.dtm.DTMManager.getDTM.

Get an instance of a DTM, loaded with the content from the specified source.

public DTM

Returns:

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

Implements abstract com.sun.org.apache.xml.internal.dtm.DTMManager.getDTM.

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

public int

Returns:

a valid DTM handle.
getDTMHandleFromNode
(Node
Non-null reference to a DOM node.
node
)

Implements abstract com.sun.org.apache.xml.internal.dtm.DTMManager.getDTMHandleFromNode.

Given a W3C DOM node, try and return a DTM handle.

public int
public DTMManager
getDTMManager()

Return the DTMManager object.

public DTMXRTreeFrag

Returns:

DTMXRTreeFrag
getDTMXRTreeFrag
(int dtmIdentity)

Gets DTMXRTreeFrag object if one has already been created.

public final ErrorListener

Returns:

A non-null ErrorListener reference.
getErrorListener
()

Get the ErrorListener where errors and warnings are to be reported.

public ExpressionContext

Returns:

An object that implements the ExpressionContext.
getExpressionContext
()

The the expression context for extensions for this context.

public DTM

Returns:

a non-null DTM reference.
getGlobalRTFDTM
()

Get a DTM to be used as a container for a global Result Tree Fragment.

public final int
getIteratorRoot()

Get the current location path iterator root.

public final PrefixResolver

Returns:

the current prefix resolver for resolving prefixes to namespace URLs.
getNamespaceContext
()

Get the current namespace context for the xpath.

public Object

Returns:

The owner object passed into the constructor, or null.
getOwnerObject
()

Get the "owner" context of this context, which should be, in the case of XSLT, the Transformer object.

public final int
public final int
getPredicateRoot()

Get the current predicate root.

public final XMLReader

Returns:

The reader of the primary source tree.
getPrimaryReader
()

Get primary XMLReader associated with this execution context.

public DTM

Returns:

a non-null DTM reference.
getRTFDTM
()

Get a DTM to be used as a container for a dynamic Result Tree Fragment.

public SourceLocator

Returns:

The location within the stylesheet, or null if not known.
getSAXLocator
()

Get the current locater in the stylesheet.

public SubContextList

Returns:

the sub-context node list.
getSubContextList
()

Get the current axes iterator, or return null if none.

public final URIResolver

Returns:

a URI resolver, which may be null.
getURIResolver
()

Get the URIResolver associated with this execution context.

public final VariableStack

Returns:

the variable stack, which should not be null.
getVarStack
()

Get the variable stack, which is in charge of variables and parameters.

private void
init(boolean overrideDefaultParser)

public boolean
isSecureProcessing()

Return the state of the secure processing feature

public final void
popContextNodeList()

Pop the current context node list.

public final void
popCurrentExpressionNode()

Pop the current node that is the expression's context (i.e. for current() support).

public final void
popCurrentNode()

Pop the current context node.

public final void
popCurrentNodeAndExpression()

Set the current context node.

public final void
popExpressionState()

Pop the current context node, expression node, and prefix resolver.

public final void
popIteratorRoot()

Pop the current location path iterator root.

public final void
popNamespaceContext()

Pop the current namespace context for the xpath.

public final void
public final void
popPredicateRoot()

Pop the current predicate root.

public void
popRTFContext()

Pop the RTFDTM's context mark.

public void
popSAXLocator()

Pop the current locater.

public final void
popSubContextList()

Pop the last pushed axes iterator.

public final void
pushContextNodeList(DTMIterator
the current node list, also referred to here as a context node list.
nl
)

Set the current context node list.

public final void
pushCurrentExpressionNode(int
The sub-expression node to be current.
n
)

Set the current node that is the expression's context (i.e. for current() support).

public final void
pushCurrentNode(int n)

Set the current context node.

public final void
pushCurrentNodeAndExpression(int cn, int
the sub-expression context node.
en
)

Set the current context node and expression node.

public final void
pushExpressionState(int cn, int
the sub-expression context node.
en
,
PrefixResolver
the namespace context (prefix resolver.
nc
)

Push the current context node, expression node, and prefix resolver.

public final void
pushIteratorRoot(int n)

Set the current location path iterator root.

public final void
pushNamespaceContext(PrefixResolver
the prefix resolver to be used for resolving prefixes to namespace URLs.
pr
)

Push a current namespace context for the xpath.

public final void
pushNamespaceContextNull()

Just increment the namespace contest stack, so that setNamespaceContext can be used on the slot.

public final void
public final void
pushPredicateRoot(int n)

Set the current predicate root.

public void
pushRTFContext()

Push the RTFDTM's context mark, to allows discarding RTFs added after this point.

public void
pushSAXLocator(SourceLocator
The location within the stylesheet.
location
)

Set the current locater in the stylesheet.

public void
pushSAXLocatorNull()

Push a slot on the locations stack so that setSAXLocator can be repeatedly called.

public final void
pushSubContextList(SubContextList
A sub-context AxesWalker.
iter
)

Push a TreeWalker on the stack.

public boolean

Returns:

true if the DTM was removed, false if it was put back in a lru pool.
release
(DTM
The DTM to be released.
dtm
,
boolean
True if the DTM should be removed no matter what.
shouldHardDelete
)

Implements abstract com.sun.org.apache.xml.internal.dtm.DTMManager.release.

Release a DTM either to a lru pool, or completely remove reference.

private final void
releaseDTMXRTreeFrags()

Cleans DTMXRTreeFrag objects by removing references to DTM and XPathContext objects.

public void
reset()

Reset for new run.

public void
public void
public void
public void
public void
setErrorListener(ErrorListener
A non-null ErrorListener reference.
listener
)

Set the ErrorListener where errors and warnings are to be reported.

public final void
setNamespaceContext(PrefixResolver
the prefix resolver to be used for resolving prefixes to namespace URLs.
pr
)

Get the current namespace context for the xpath.

public void
setPrimaryReader(XMLReader
The reader of the primary source tree.
reader
)

Set primary XMLReader associated with this execution context.

public void
setSAXLocator(SourceLocator
The location within the stylesheet.
location
)

Set the current locater in the stylesheet.

public void
setSecureProcessing(boolean flag)

Set the state of the secure processing feature

public void
setURIResolver(URIResolver
the URIResolver to be associated with this execution context, may be null to clear an already set resolver.
resolver
)

Set the URIResolver associated with this execution context.

public final void
setVarStack(VariableStack
non-null reference to the variable stack.
varStack
)

Get the variable stack, which is in charge of variables and parameters.

Inherited from com.sun.org.apache.xml.internal.dtm.DTMManager:
getDTMIdentityMaskgetIncrementalgetNodeIdentityMaskgetSource_locationgetXMLStringFactorynewInstanceoverrideDefaultParsersetIncrementalsetOverrideDefaultParsersetSource_locationsetXMLStringFactory