BEA Systems, Inc.


weblogic.apache.xpath
Class XPathContext

java.lang.Object
  |
  +--weblogic.apache.xml.dtm.DTMManager
        |
        +--weblogic.apache.xpath.XPathContext
Direct Known Subclasses:
XPathSupportDefault

public class XPathContext
extends weblogic.apache.xml.dtm.DTMManager

Default class for the runtime execution context for XPath.

This class extends DTMManager but does not directly implement it.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.


Inner Class Summary
 class XPathContext.XPathExpressionContext
           
 
Field Summary
protected  int m_currentExpressionNodesFirstFree
           
protected  int m_currentNodesFirstFree
           
protected  weblogic.apache.xml.dtm.DTMManager m_dtmManager
          Though XPathContext context extends the DTMManager, it really is a proxy for this object, which is the real DTMManager.
 org.xml.sax.XMLReader m_primaryReader
          The reader of the primary source tree.
static int RECURSIONLIMIT
          The ammount to use for stacks that record information during the recursive execution.
 
Fields inherited from class weblogic.apache.xml.dtm.DTMManager
IDENT_DTM_DEFAULT, IDENT_DTM_NODE_BITS, IDENT_MAX_DTMS, IDENT_NODE_DEFAULT, m_incremental, m_xsf
 
Constructor Summary
XPathContext()
          Create an XPathContext instance.
XPathContext(java.lang.Object owner)
          Create an XPathContext instance.
 
Method Summary
 weblogic.apache.xml.dtm.DTM createDocumentFragment()
          Creates an empty DocumentFragment object.
 weblogic.apache.xml.dtm.DTMIterator createDTMIterator(int node)
          Create a new DTMIterator that holds exactly one node.
 weblogic.apache.xml.dtm.DTMIterator createDTMIterator(int whatToShow, weblogic.apache.xml.dtm.DTMFilter filter, boolean entityReferenceExpansion)
          Create a new DTMIterator based only on a whatToShow and a DTMFilter.
 weblogic.apache.xml.dtm.DTMIterator createDTMIterator(java.lang.Object xpathCompiler, int pos)
          Create a new DTMIterator based on an XPath UnionExpr.
 weblogic.apache.xml.dtm.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.
 weblogic.apache.xml.dtm.DTMIterator getContextNodeList()
          Get the current context node list.
 java.util.Stack getContextNodeListsStack()
           
 weblogic.apache.xml.dtm.DTMIterator getContextNodes()
          Get the current context node list.
 int getCurrentExpressionNode()
          Get the current node that is the expression's context (i.e.
 int getCurrentExpressionNodesFirstFree()
           
 int[] getCurrentExpressionNodeStack()
           
 int getCurrentNode()
          Get the current context node.
 int getCurrentNodeFirstFree()
           
 LocPathIterator getCurrentNodeList()
           Get the current node list as defined by the XSLT spec.
 int[] getCurrentNodeStack()
           
 weblogic.apache.xml.dtm.DTM getDTM(int nodeHandle)
          Get an instance of a DTM that "owns" a node handle.
 weblogic.apache.xml.dtm.DTM getDTM(javax.xml.transform.Source source, boolean unique, weblogic.apache.xml.dtm.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(weblogic.apache.xml.dtm.DTM dtm)
          %TBD% Doc
 weblogic.apache.xml.dtm.DTMManager getDTMManager()
          Return the DTMManager object.
 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.
 ExtensionsTable getExtensionsTable()
          Get the extensions table object.
 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.
 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.
 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 popSAXLocator()
          Pop the current locater.
 void popSubContextList()
           Pop the last pushed axes iterator.
 void pushContextNodeList(weblogic.apache.xml.dtm.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 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(weblogic.apache.xml.dtm.DTM dtm, boolean shouldHardDelete)
          Release a DTM either to a lru pool, or completely remove reference.
 void reset()
          Reset for new run.
 void setAxesIteratorStackStacks(java.util.Stack s)
           
 void setContextNodeListsStack(java.util.Stack s)
           
 void setCurrentExpressionNodeStack(int[] nv)
           
 void setCurrentNodeStack(int[] 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 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 weblogic.apache.xml.dtm.DTMManager
getDTMIdentityMask, getIncremental, getNodeIdentityMask, getXMLStringFactory, newInstance, setIncremental, setXMLStringFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_dtmManager

protected weblogic.apache.xml.dtm.DTMManager m_dtmManager
Though XPathContext context extends the DTMManager, it really is a proxy for this object, which is the real DTMManager.

m_primaryReader

public org.xml.sax.XMLReader m_primaryReader
The reader of the primary source tree.

RECURSIONLIMIT

public static final int RECURSIONLIMIT
The ammount to use for stacks that record information during the recursive execution.

m_currentNodesFirstFree

protected int m_currentNodesFirstFree

m_currentExpressionNodesFirstFree

protected int m_currentExpressionNodesFirstFree
Constructor Detail

XPathContext

public XPathContext()
Create an XPathContext instance.

XPathContext

public XPathContext(java.lang.Object owner)
Create an XPathContext instance.

Parameters:
owner - Value that can be retrieved via the getOwnerObject() method.
See Also:
getOwnerObject()
Method Detail

getDTMManager

public weblogic.apache.xml.dtm.DTMManager getDTMManager()
Return the DTMManager object. Though XPathContext context extends the DTMManager, it really is a proxy for the real DTMManager. If a caller needs to make a lot of calls to the DTMManager, it is faster if it gets the real one from this function.

getDTM

public weblogic.apache.xml.dtm.DTM getDTM(javax.xml.transform.Source source,
                                          boolean unique,
                                          weblogic.apache.xml.dtm.DTMWSFilter wsfilter,
                                          boolean incremental,
                                          boolean doIndexing)
Get an instance of a DTM, loaded with the content from the specified source. If the unique flag is true, a new instance will always be returned. Otherwise it is up to the DTMManager to return a new instance or an instance that it already created and may be being used by someone else. (I think more parameters will need to be added for error handling, and entity resolution).

Parameters:
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.
whiteSpaceFilter - 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.
Returns:
a non-null DTM reference.
Overrides:
getDTM in class weblogic.apache.xml.dtm.DTMManager

getDTM

public weblogic.apache.xml.dtm.DTM getDTM(int nodeHandle)
Get an instance of a DTM that "owns" a node handle.

Parameters:
nodeHandle - the nodeHandle.
Returns:
a non-null DTM reference.
Overrides:
getDTM in class weblogic.apache.xml.dtm.DTMManager

getDTMHandleFromNode

public int getDTMHandleFromNode(org.w3c.dom.Node node)
Given a W3C DOM node, try and return a DTM handle. Note: calling this may be non-optimal.

Parameters:
node - Non-null reference to a DOM node.
Returns:
a valid DTM handle.
Overrides:
getDTMHandleFromNode in class weblogic.apache.xml.dtm.DTMManager

getDTMIdentity

public int getDTMIdentity(weblogic.apache.xml.dtm.DTM dtm)
%TBD% Doc

Overrides:
getDTMIdentity in class weblogic.apache.xml.dtm.DTMManager

createDocumentFragment

public weblogic.apache.xml.dtm.DTM createDocumentFragment()
Creates an empty DocumentFragment object.

Returns:
A new DocumentFragment handle.
Overrides:
createDocumentFragment in class weblogic.apache.xml.dtm.DTMManager

release

public boolean release(weblogic.apache.xml.dtm.DTM dtm,
                       boolean shouldHardDelete)
Release a DTM either to a lru pool, or completely remove reference. DTMs without system IDs are always hard deleted. State: experimental.

Parameters:
dtm - The DTM to be released.
shouldHardDelete - True if the DTM should be removed no matter what.
Returns:
true if the DTM was removed, false if it was put back in a lru pool.
Overrides:
release in class weblogic.apache.xml.dtm.DTMManager

createDTMIterator

public weblogic.apache.xml.dtm.DTMIterator createDTMIterator(java.lang.Object xpathCompiler,
                                                             int pos)
Create a new DTMIterator based on an XPath UnionExpr.

Parameters:
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.
Returns:
The newly created DTMIterator.
Overrides:
createDTMIterator in class weblogic.apache.xml.dtm.DTMManager

createDTMIterator

public weblogic.apache.xml.dtm.DTMIterator createDTMIterator(java.lang.String xpathString,
                                                             PrefixResolver presolver)
Create a new DTMIterator based on an XPath UnionExpr.

Parameters:
xpathString - Must be a valid string expressing a UnionExpr.
presolver - An object that can resolve prefixes to namespace URLs.
Returns:
The newly created DTMIterator.
Overrides:
createDTMIterator in class weblogic.apache.xml.dtm.DTMManager

createDTMIterator

public weblogic.apache.xml.dtm.DTMIterator createDTMIterator(int whatToShow,
                                                             weblogic.apache.xml.dtm.DTMFilter filter,
                                                             boolean entityReferenceExpansion)
Create a new DTMIterator based only on a whatToShow and a DTMFilter. The traversal semantics are defined as the descendant access.

Parameters:
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.
Returns:
The newly created NodeIterator.
Overrides:
createDTMIterator in class weblogic.apache.xml.dtm.DTMManager

createDTMIterator

public weblogic.apache.xml.dtm.DTMIterator createDTMIterator(int node)
Create a new DTMIterator that holds exactly one node.

Parameters:
node - The node handle that the DTMIterator will iterate to.
Returns:
The newly created DTMIterator.
Overrides:
createDTMIterator in class weblogic.apache.xml.dtm.DTMManager

reset

public void reset()
Reset for new run.

setSAXLocator

public void setSAXLocator(javax.xml.transform.SourceLocator location)
Set the current locater in the stylesheet.

Parameters:
location - The location within the stylesheet.

pushSAXLocator

public void pushSAXLocator(javax.xml.transform.SourceLocator location)
Set the current locater in the stylesheet.

Parameters:
location - The location within the stylesheet.

pushSAXLocatorNull

public void pushSAXLocatorNull()
Push a slot on the locations stack so that setSAXLocator can be repeatedly called.

Parameters:
location - The location within the stylesheet.

popSAXLocator

public void popSAXLocator()
Pop the current locater.

getSAXLocator

public javax.xml.transform.SourceLocator getSAXLocator()
Get the current locater in the stylesheet.

Returns:
The location within the stylesheet, or null if not known.

getOwnerObject

public java.lang.Object getOwnerObject()
Get the "owner" context of this context, which should be, in the case of XSLT, the Transformer object. This is needed so that XSLT functions can get the Transformer.

Returns:
The owner object passed into the constructor, or null.

getExtensionsTable

public ExtensionsTable getExtensionsTable()
Get the extensions table object.

Returns:
The extensions table.

getVarStack

public final VariableStack getVarStack()
Get the variable stack, which is in charge of variables and parameters.

Returns:
the variable stack, which should not be null.

setVarStack

public final void setVarStack(VariableStack varStack)
Get the variable stack, which is in charge of variables and parameters.

Parameters:
varStack - non-null reference to the variable stack.

getSourceTreeManager

public final SourceTreeManager getSourceTreeManager()
Get the SourceTreeManager associated with this execution context.

Returns:
the SourceTreeManager associated with this execution context.

setSourceTreeManager

public void setSourceTreeManager(SourceTreeManager mgr)
Set the SourceTreeManager associated with this execution context.

Parameters:
mgr - the SourceTreeManager to be associated with this execution context.

getErrorListener

public final javax.xml.transform.ErrorListener getErrorListener()
Get the ErrorListener where errors and warnings are to be reported.

Returns:
A non-null ErrorListener reference.

setErrorListener

public void setErrorListener(javax.xml.transform.ErrorListener listener)
                      throws java.lang.IllegalArgumentException
Set the ErrorListener where errors and warnings are to be reported.

Parameters:
listener - A non-null ErrorListener reference.

getURIResolver

public final javax.xml.transform.URIResolver getURIResolver()
Get the URIResolver associated with this execution context.

Returns:
a URI resolver, which may be null.

setURIResolver

public void setURIResolver(javax.xml.transform.URIResolver resolver)
Set the URIResolver associated with this execution context.

Parameters:
resolver - the URIResolver to be associated with this execution context, may be null to clear an already set resolver.

getPrimaryReader

public final org.xml.sax.XMLReader getPrimaryReader()
Get primary XMLReader associated with this execution context.

Returns:
The reader of the primary source tree.

setPrimaryReader

public void setPrimaryReader(org.xml.sax.XMLReader reader)
Set primary XMLReader associated with this execution context.

Parameters:
reader - The reader of the primary source tree.

getContextNodeListsStack

public java.util.Stack getContextNodeListsStack()

setContextNodeListsStack

public void setContextNodeListsStack(java.util.Stack s)

getContextNodeList

public final weblogic.apache.xml.dtm.DTMIterator getContextNodeList()
Get the current context node list.

Returns:
the current node list, also refered to here as a context node list.

pushContextNodeList

public final void pushContextNodeList(weblogic.apache.xml.dtm.DTMIterator nl)
Set the current context node list.

Parameters:
nl - the current node list, also refered to here as a context node list.

popContextNodeList

public final void popContextNodeList()
Pop the current context node list.

getCurrentNodeStack

public int[] getCurrentNodeStack()

setCurrentNodeStack

public void setCurrentNodeStack(int[] nv)

getCurrentNode

public final int getCurrentNode()
Get the current context node.

Returns:
the current node.

pushCurrentNodeAndExpression

public final void pushCurrentNodeAndExpression(int cn,
                                               int en)
Set the current context node and expression node.

Parameters:
cn - the current node.
en - the sub-expression context node.

popCurrentNodeAndExpression

public final void popCurrentNodeAndExpression()
Set the current context node.

pushExpressionState

public final void pushExpressionState(int cn,
                                      int en,
                                      PrefixResolver nc)
Push the current context node, expression node, and prefix resolver.

Parameters:
cn - the current node.
en - the sub-expression context node.
nc - the namespace context (prefix resolver.

popExpressionState

public final void popExpressionState()
Pop the current context node, expression node, and prefix resolver.

pushCurrentNode

public final void pushCurrentNode(int n)
Set the current context node.

Parameters:
n - the current node.

getCurrentNodeFirstFree

public int getCurrentNodeFirstFree()

popCurrentNode

public final void popCurrentNode()
Pop the current context node.

pushPredicateRoot

public final void pushPredicateRoot(int n)
Set the current predicate root.

popPredicateRoot

public final void popPredicateRoot()
Pop the current predicate root.

getPredicateRoot

public final int getPredicateRoot()
Get the current predicate root.

pushIteratorRoot

public final void pushIteratorRoot(int n)
Set the current location path iterator root.

popIteratorRoot

public final void popIteratorRoot()
Pop the current location path iterator root.

getIteratorRoot

public final int getIteratorRoot()
Get the current location path iterator root.

getCurrentExpressionNodeStack

public int[] getCurrentExpressionNodeStack()

setCurrentExpressionNodeStack

public void setCurrentExpressionNodeStack(int[] nv)

getCurrentExpressionNodesFirstFree

public int getCurrentExpressionNodesFirstFree()

getPredicatePos

public final int getPredicatePos()

pushPredicatePos

public final void pushPredicatePos(int n)

popPredicatePos

public final void popPredicatePos()

getCurrentExpressionNode

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

Returns:
The current sub-expression node.

pushCurrentExpressionNode

public final void pushCurrentExpressionNode(int n)
Set the current node that is the expression's context (i.e. for current() support).

Parameters:
n - The sub-expression node to be current.

popCurrentExpressionNode

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

getNamespaceContext

public final PrefixResolver getNamespaceContext()
Get the current namespace context for the xpath.

Returns:
the current prefix resolver for resolving prefixes to namespace URLs.

setNamespaceContext

public final void setNamespaceContext(PrefixResolver pr)
Get the current namespace context for the xpath.

Parameters:
pr - the prefix resolver to be used for resolving prefixes to namespace URLs.

pushNamespaceContext

public final void pushNamespaceContext(PrefixResolver pr)
Push a current namespace context for the xpath.

Parameters:
pr - the prefix resolver to be used for resolving prefixes to namespace URLs.

pushNamespaceContextNull

public final void pushNamespaceContextNull()
Just increment the namespace contest stack, so that setNamespaceContext can be used on the slot.

popNamespaceContext

public final void popNamespaceContext()
Pop the current namespace context for the xpath.

getAxesIteratorStackStacks

public java.util.Stack getAxesIteratorStackStacks()

setAxesIteratorStackStacks

public void setAxesIteratorStackStacks(java.util.Stack s)

pushSubContextList

public final void pushSubContextList(SubContextList iter)
Push a TreeWalker on the stack.

Parameters:
iter - A sub-context AxesWalker.

popSubContextList

public final void popSubContextList()
Pop the last pushed axes iterator.

getSubContextList

public SubContextList getSubContextList()
Get the current axes iterator, or return null if none.

Returns:
the sub-context node list.

getCurrentNodeList

public LocPathIterator getCurrentNodeList()
Get the current node list as defined by the XSLT spec.

Returns:
the current node list.

getContextNode

public final int getContextNode()
Get the current context node.

Returns:
The current context node.

getContextNodes

public final weblogic.apache.xml.dtm.DTMIterator getContextNodes()
Get the current context node list.

Returns:
An iterator for the current context list, as defined in XSLT.

getExpressionContext

public ExpressionContext getExpressionContext()
The the expression context for extensions for this context.

Returns:
An object that implements the ExpressionContext.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs70

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference