|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.dtm.DTMManager org.apache.xpath.XPathContext
public class XPathContext
Default class for the runtime execution context for XPath.
This class extends DTMManager but does not directly implement it.
Nested Class Summary | |
---|---|
class |
XPathContext.XPathExpressionContext
|
Field Summary | |
---|---|
(package private) XPathContext.XPathExpressionContext |
expressionContext
|
private java.util.Stack |
m_axesIteratorStack
Stack of AxesIterators. |
private java.util.Stack |
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 javax.xml.transform.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 java.util.HashMap |
m_DTMXRTreeFrags
HashMap of cached the DTMXRTreeFrag objects, which are identified by DTM IDs. |
private javax.xml.transform.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. |
(package private) IntStack |
m_last_pushed_rtfdtm
|
private java.lang.Object |
m_owner
The owner context of this XPathContext. |
private java.lang.reflect.Method |
m_ownerGetErrorListener
The owner context of this XPathContext. |
private IntStack |
m_predicatePos
|
private NodeVector |
m_predicateRoots
A stack of the current sub-expression nodes. |
private ObjectStack |
m_prefixResolvers
|
org.xml.sax.XMLReader |
m_primaryReader
The reader of the primary source tree. |
private java.util.Vector |
m_rtfdtm_stack
Stack of cached "reusable" DTMs for Result Tree Fragments. |
(package private) ObjectStack |
m_saxLocations
The current stylesheet locator. |
private SourceTreeManager |
m_sourceTreeManager
The source tree manager, which associates Source objects to source tree nodes. |
private javax.xml.transform.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 |
static int |
RECURSIONLIMIT
The ammount to use for stacks that record information during the recursive execution. |
Fields inherited from class org.apache.xml.dtm.DTMManager |
---|
IDENT_DTM_DEFAULT, IDENT_DTM_NODE_BITS, IDENT_MAX_DTMS, IDENT_NODE_DEFAULT, m_incremental, m_source_location, m_xsf |
Constructor Summary | |
---|---|
XPathContext()
Create an XPathContext instance. |
|
XPathContext(boolean recursiveVarContext)
Create an XPathContext instance. |
|
XPathContext(java.lang.Object owner)
Create an XPathContext instance. |
|
XPathContext(java.lang.Object owner,
boolean recursiveVarContext)
Create an XPathContext instance. |
Method Summary | |
---|---|
private void |
assertion(boolean b,
java.lang.String msg)
Tell the user of an assertion error, and probably throw an exception. |
DTM |
createDocumentFragment()
Creates an empty DocumentFragment object. |
DTMIterator |
createDTMIterator(int node)
Create a new DTMIterator that holds exactly one node. |
DTMIterator |
createDTMIterator(int whatToShow,
DTMFilter filter,
boolean entityReferenceExpansion)
Create a new DTMIterator based only on a whatToShow and
a DTMFilter. |
DTMIterator |
createDTMIterator(java.lang.Object xpathCompiler,
int pos)
Create a new DTMIterator based on an XPath
UnionExpr. |
DTMIterator |
createDTMIterator(java.lang.String xpathString,
PrefixResolver presolver)
Create a new DTMIterator based on an XPath
UnionExpr. |
java.util.Stack |
getAxesIteratorStackStacks()
|
int |
getContextNode()
Get the current context node. |
DTMIterator |
getContextNodeList()
Get the current context node list. |
java.util.Stack |
getContextNodeListsStack()
|
DTMIterator |
getContextNodes()
Get the current context node list. |
int |
getCurrentExpressionNode()
Get the current node that is the expression's context (i.e. |
IntStack |
getCurrentExpressionNodeStack()
|
int |
getCurrentNode()
Get the current context node. |
SubContextList |
getCurrentNodeList()
Get the current node list as defined by the XSLT spec. |
IntStack |
getCurrentNodeStack()
|
DTM |
getDTM(int nodeHandle)
Get an instance of a DTM that "owns" a node handle. |
DTM |
getDTM(javax.xml.transform.Source source,
boolean unique,
DTMWSFilter wsfilter,
boolean incremental,
boolean doIndexing)
Get an instance of a DTM, loaded with the content from the specified source. |
int |
getDTMHandleFromNode(org.w3c.dom.Node node)
Given a W3C DOM node, try and return a DTM handle. |
int |
getDTMIdentity(DTM dtm)
%TBD% Doc |
DTMManager |
getDTMManager()
Return the DTMManager object. |
DTMXRTreeFrag |
getDTMXRTreeFrag(int dtmIdentity)
Gets DTMXRTreeFrag object if one has already been created. |
javax.xml.transform.ErrorListener |
getErrorListener()
Get the ErrorListener where errors and warnings are to be reported. |
ExpressionContext |
getExpressionContext()
The the expression context for extensions for this context. |
DTM |
getGlobalRTFDTM()
Get a DTM to be used as a container for a global Result Tree Fragment. |
int |
getIteratorRoot()
Get the current location path iterator root. |
PrefixResolver |
getNamespaceContext()
Get the current namespace context for the xpath. |
java.lang.Object |
getOwnerObject()
Get the "owner" context of this context, which should be, in the case of XSLT, the Transformer object. |
int |
getPredicatePos()
|
int |
getPredicateRoot()
Get the current predicate root. |
org.xml.sax.XMLReader |
getPrimaryReader()
Get primary XMLReader associated with this execution context. |
DTM |
getRTFDTM()
Get a DTM to be used as a container for a dynamic Result Tree Fragment. |
javax.xml.transform.SourceLocator |
getSAXLocator()
Get the current locater in the stylesheet. |
SourceTreeManager |
getSourceTreeManager()
Get the SourceTreeManager associated with this execution context. |
SubContextList |
getSubContextList()
Get the current axes iterator, or return null if none. |
javax.xml.transform.URIResolver |
getURIResolver()
Get the URIResolver associated with this execution context. |
VariableStack |
getVarStack()
Get the variable stack, which is in charge of variables and parameters. |
boolean |
isSecureProcessing()
Return the state of the secure processing feature |
void |
popContextNodeList()
Pop the current context node list. |
void |
popCurrentExpressionNode()
Pop the current node that is the expression's context (i.e. |
void |
popCurrentNode()
Pop the current context node. |
void |
popCurrentNodeAndExpression()
Set the current context node. |
void |
popExpressionState()
Pop the current context node, expression node, and prefix resolver. |
void |
popIteratorRoot()
Pop the current location path iterator root. |
void |
popNamespaceContext()
Pop the current namespace context for the xpath. |
void |
popPredicatePos()
|
void |
popPredicateRoot()
Pop the current predicate root. |
void |
popRTFContext()
Pop the RTFDTM's context mark. |
void |
popSAXLocator()
Pop the current locater. |
void |
popSubContextList()
Pop the last pushed axes iterator. |
void |
pushContextNodeList(DTMIterator nl)
Set the current context node list. |
void |
pushCurrentExpressionNode(int n)
Set the current node that is the expression's context (i.e. |
void |
pushCurrentNode(int n)
Set the current context node. |
void |
pushCurrentNodeAndExpression(int cn,
int en)
Set the current context node and expression node. |
void |
pushExpressionState(int cn,
int en,
PrefixResolver nc)
Push the current context node, expression node, and prefix resolver. |
void |
pushIteratorRoot(int n)
Set the current location path iterator root. |
void |
pushNamespaceContext(PrefixResolver pr)
Push a current namespace context for the xpath. |
void |
pushNamespaceContextNull()
Just increment the namespace contest stack, so that setNamespaceContext can be used on the slot. |
void |
pushPredicatePos(int n)
|
void |
pushPredicateRoot(int n)
Set the current predicate root. |
void |
pushRTFContext()
Push the RTFDTM's context mark, to allows discarding RTFs added after this point. |
void |
pushSAXLocator(javax.xml.transform.SourceLocator location)
Set the current locater in the stylesheet. |
void |
pushSAXLocatorNull()
Push a slot on the locations stack so that setSAXLocator can be repeatedly called. |
void |
pushSubContextList(SubContextList iter)
Push a TreeWalker on the stack. |
boolean |
release(DTM dtm,
boolean shouldHardDelete)
Release a DTM either to a lru pool, or completely remove reference. |
private void |
releaseDTMXRTreeFrags()
Cleans DTMXRTreeFrag objects by removing references to DTM and XPathContext objects. |
void |
reset()
Reset for new run. |
void |
setAxesIteratorStackStacks(java.util.Stack s)
|
void |
setContextNodeListsStack(java.util.Stack s)
|
void |
setCurrentExpressionNodeStack(IntStack nv)
|
void |
setCurrentNodeStack(IntStack nv)
|
void |
setErrorListener(javax.xml.transform.ErrorListener listener)
Set the ErrorListener where errors and warnings are to be reported. |
void |
setNamespaceContext(PrefixResolver pr)
Get the current namespace context for the xpath. |
void |
setPrimaryReader(org.xml.sax.XMLReader reader)
Set primary XMLReader associated with this execution context. |
void |
setSAXLocator(javax.xml.transform.SourceLocator location)
Set the current locater in the stylesheet. |
void |
setSecureProcessing(boolean flag)
Set the state of the secure processing feature |
void |
setSourceTreeManager(SourceTreeManager mgr)
Set the SourceTreeManager associated with this execution context. |
void |
setURIResolver(javax.xml.transform.URIResolver resolver)
Set the URIResolver associated with this execution context. |
void |
setVarStack(VariableStack varStack)
Get the variable stack, which is in charge of variables and parameters. |
Methods inherited from class org.apache.xml.dtm.DTMManager |
---|
getDTMIdentityMask, getIncremental, getNodeIdentityMask, getSource_location, getXMLStringFactory, newInstance, setIncremental, setSource_location, setXMLStringFactory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
IntStack m_last_pushed_rtfdtm
private java.util.Vector m_rtfdtm_stack
private int m_which_rtfdtm
private SAX2RTFDTM m_global_rtfdtm
private java.util.HashMap m_DTMXRTreeFrags
private boolean m_isSecureProcessing
protected DTMManager m_dtmManager
ObjectStack m_saxLocations
private java.lang.Object m_owner
private java.lang.reflect.Method m_ownerGetErrorListener
private VariableStack m_variableStacks
private SourceTreeManager m_sourceTreeManager
private javax.xml.transform.ErrorListener m_errorListener
private javax.xml.transform.ErrorListener m_defaultErrorListener
private javax.xml.transform.URIResolver m_uriResolver
public org.xml.sax.XMLReader m_primaryReader
private java.util.Stack m_contextNodeLists
public static final int RECURSIONLIMIT
private IntStack m_currentNodes
private NodeVector m_iteratorRoots
private NodeVector m_predicateRoots
private IntStack m_currentExpressionNodes
private IntStack m_predicatePos
private ObjectStack m_prefixResolvers
private java.util.Stack m_axesIteratorStack
XPathContext.XPathExpressionContext expressionContext
Constructor Detail |
---|
public XPathContext()
XPathContext(boolean)
constructor with the value
true
.
public XPathContext(boolean recursiveVarContext)
recursiveVarContext
- A boolean
value indicating whether
the XPath context needs to support pushing of scopes for
variable resolutionpublic XPathContext(java.lang.Object owner)
XPathContext(java.lang.Object,boolean)
with the
value of the second parameter set to true
.
owner
- Value that can be retrieved via the getOwnerObject() method.getOwnerObject()
public XPathContext(java.lang.Object owner, boolean recursiveVarContext)
owner
- Value that can be retrieved via the getOwnerObject() method.recursiveVarContext
- A boolean
value indicating whether
the XPath context needs to support pushing of scopes for
variable resolutiongetOwnerObject()
Method Detail |
---|
public DTMManager getDTMManager()
public void setSecureProcessing(boolean flag)
public boolean isSecureProcessing()
public DTM getDTM(javax.xml.transform.Source source, boolean unique, DTMWSFilter wsfilter, boolean incremental, boolean doIndexing)
getDTM
in class DTMManager
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.unique
- true if the returned DTM must be unique, probably because it
is going to be mutated.wsfilter
- Enables filtering of whitespace nodes, and may be null.incremental
- true if the construction should try and be incremental.doIndexing
- true if the caller considers it worth it to use
indexing schemes.
public DTM getDTM(int nodeHandle)
getDTM
in class DTMManager
nodeHandle
- the nodeHandle.
public int getDTMHandleFromNode(org.w3c.dom.Node node)
getDTMHandleFromNode
in class DTMManager
node
- Non-null reference to a DOM node.
public int getDTMIdentity(DTM dtm)
getDTMIdentity
in class DTMManager
public DTM createDocumentFragment()
DocumentFragment
object.
createDocumentFragment
in class DTMManager
DocumentFragment handle
.public boolean release(DTM dtm, boolean shouldHardDelete)
release
in class DTMManager
dtm
- The DTM to be released.shouldHardDelete
- True if the DTM should be removed no matter what.
public DTMIterator createDTMIterator(java.lang.Object xpathCompiler, int pos)
DTMIterator
based on an XPath
UnionExpr.
createDTMIterator
in class DTMManager
xpathCompiler
- ??? 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.pos
- The position in the expression.
DTMIterator
.public DTMIterator createDTMIterator(java.lang.String xpathString, PrefixResolver presolver)
DTMIterator
based on an XPath
UnionExpr.
createDTMIterator
in class DTMManager
xpathString
- Must be a valid string expressing a
UnionExpr.presolver
- An object that can resolve prefixes to namespace URLs.
DTMIterator
.public DTMIterator createDTMIterator(int whatToShow, DTMFilter filter, boolean entityReferenceExpansion)
DTMIterator
based only on a whatToShow and
a DTMFilter. The traversal semantics are defined as the descendant
access.
createDTMIterator
in class DTMManager
whatToShow
- 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
.filter
- The NodeFilter
to be used with this
TreeWalker
, or null
to indicate no filter.entityReferenceExpansion
- The value of this flag determines
whether entity reference nodes are expanded.
NodeIterator
.public DTMIterator createDTMIterator(int node)
DTMIterator
that holds exactly one node.
createDTMIterator
in class DTMManager
node
- The node handle that the DTMIterator will iterate to.
DTMIterator
.public void reset()
public void setSAXLocator(javax.xml.transform.SourceLocator location)
location
- The location within the stylesheet.public void pushSAXLocator(javax.xml.transform.SourceLocator location)
location
- The location within the stylesheet.public void pushSAXLocatorNull()
public void popSAXLocator()
public javax.xml.transform.SourceLocator getSAXLocator()
public java.lang.Object getOwnerObject()
public final VariableStack getVarStack()
public final void setVarStack(VariableStack varStack)
varStack
- non-null reference to the variable stack.public final SourceTreeManager getSourceTreeManager()
public void setSourceTreeManager(SourceTreeManager mgr)
mgr
- the SourceTreeManager to be associated with this
execution context.public final javax.xml.transform.ErrorListener getErrorListener()
public void setErrorListener(javax.xml.transform.ErrorListener listener) throws java.lang.IllegalArgumentException
listener
- A non-null ErrorListener reference.
java.lang.IllegalArgumentException
public final javax.xml.transform.URIResolver getURIResolver()
public void setURIResolver(javax.xml.transform.URIResolver resolver)
resolver
- the URIResolver to be associated with this
execution context, may be null to clear an already set resolver.public final org.xml.sax.XMLReader getPrimaryReader()
public void setPrimaryReader(org.xml.sax.XMLReader reader)
reader
- The reader of the primary source tree.private void assertion(boolean b, java.lang.String msg) throws javax.xml.transform.TransformerException
b
- If false, a TransformerException will be thrown.msg
- The assertion message, which should be informative.
javax.xml.transform.TransformerException
- if b is false.public java.util.Stack getContextNodeListsStack()
public void setContextNodeListsStack(java.util.Stack s)
public final DTMIterator getContextNodeList()
public final void pushContextNodeList(DTMIterator nl)
nl
- the current node list,
also refered to here as a public final void popContextNodeList()
public IntStack getCurrentNodeStack()
public void setCurrentNodeStack(IntStack nv)
public final int getCurrentNode()
public final void pushCurrentNodeAndExpression(int cn, int en)
cn
- the current node.en
- the sub-expression context node.public final void popCurrentNodeAndExpression()
public final void pushExpressionState(int cn, int en, PrefixResolver nc)
cn
- the current node.en
- the sub-expression context node.nc
- the namespace context (prefix resolver.public final void popExpressionState()
public final void pushCurrentNode(int n)
n
- the current node.public final void popCurrentNode()
public final void pushPredicateRoot(int n)
public final void popPredicateRoot()
public final int getPredicateRoot()
public final void pushIteratorRoot(int n)
public final void popIteratorRoot()
public final int getIteratorRoot()
public IntStack getCurrentExpressionNodeStack()
public void setCurrentExpressionNodeStack(IntStack nv)
public final int getPredicatePos()
public final void pushPredicatePos(int n)
public final void popPredicatePos()
public final int getCurrentExpressionNode()
public final void pushCurrentExpressionNode(int n)
n
- The sub-expression node to be current.public final void popCurrentExpressionNode()
public final PrefixResolver getNamespaceContext()
public final void setNamespaceContext(PrefixResolver pr)
pr
- the prefix resolver to be used for resolving prefixes to
namespace URLs.public final void pushNamespaceContext(PrefixResolver pr)
pr
- the prefix resolver to be used for resolving prefixes to
namespace URLs.public final void pushNamespaceContextNull()
public final void popNamespaceContext()
public java.util.Stack getAxesIteratorStackStacks()
public void setAxesIteratorStackStacks(java.util.Stack s)
public final void pushSubContextList(SubContextList iter)
iter
- A sub-context AxesWalker.public final void popSubContextList()
public SubContextList getSubContextList()
public SubContextList getCurrentNodeList()
public final int getContextNode()
public final DTMIterator getContextNodes()
public ExpressionContext getExpressionContext()
public DTM getGlobalRTFDTM()
public DTM getRTFDTM()
public void pushRTFContext()
public void popRTFContext()
public DTMXRTreeFrag getDTMXRTreeFrag(int dtmIdentity)
dtmIdentity
-
private final void releaseDTMXRTreeFrags()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |