BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.apache.xpath
Class XPathContext

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

public class XPathContext
extends java.lang.Object
implements ExpressionContext

Default class for the runtime execution context for XPath.

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.


Field Summary
 org.xml.sax.XMLReader m_primaryReader
          The reader of the primary source tree.
 
Constructor Summary
XPathContext()
          Create an XPathContext instance.
XPathContext(java.lang.Object owner)
          Create an XPathContext instance.
 
Method Summary
 org.w3c.dom.Node getContextNode()
          Get the current context node.
 ContextNodeList getContextNodeList()
          Get the current context node list.
 org.w3c.dom.traversal.NodeIterator getContextNodes()
          Get the current context node list.
 org.w3c.dom.Node getCurrentExpressionNode()
          Get the current node that is the expression's context (i.e.
 org.w3c.dom.Node getCurrentNode()
          Get the current context node.
 LocPathIterator getCurrentNodeList()
           
 DOMHelper getDOMHelper()
          Get the DOMHelper associated with this execution context.
 javax.xml.transform.ErrorListener getErrorListener()
          Get the ErrorListener where errors and warnings are to be reported.
 ExtensionsTable getExtensionsTable()
          Get the extensions table object.
 org.w3c.dom.Node 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.
 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.
 XObject getVariable(QName qname)
          Given a name, locate a variable in the current context, and return the Object.
 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 popIteratorRoot()
          Pop the current location path iterator root.
 void popSubContextList()
           Pop the last pushed axes iterator.
 void pushContextNodeList(ContextNodeList nl)
           Set the current context node list.
 void pushCurrentExpressionNode(org.w3c.dom.Node n)
          Set the current node that is the expression's context (i.e.
 void pushCurrentNode(org.w3c.dom.Node n)
          Set the current context node.
 void pushCurrentNodeAndExpression(org.w3c.dom.Node cn, org.w3c.dom.Node en)
          Set the current context node and expression node.
 void pushIteratorRoot(org.w3c.dom.Node n)
          Set the current location path iterator root.
 void pushSubContextList(SubContextList iter)
           Push a TreeWalker on the stack.
 void reset()
          Reset for new run.
 void setDOMHelper(DOMHelper helper)
          Set the DOMHelper associated with this execution context.
 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.
 double toNumber(org.w3c.dom.Node n)
          Get the value of a node as a number.
 java.lang.String toString(org.w3c.dom.Node n)
          Get the value of a node as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_primaryReader

public org.xml.sax.XMLReader m_primaryReader
The reader of the primary source tree.
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

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.

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 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 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.

getVariable

public XObject getVariable(QName qname)
                    throws javax.xml.transform.TransformerException
Given a name, locate a variable in the current context, and return the Object.

Parameters:
qname - The qualified name of a variable.
Returns:
reference to variable, or null if not found.
Throws:
javax.xml.transform.TransformerException -  

getDOMHelper

public final DOMHelper getDOMHelper()
Get the DOMHelper associated with this execution context.

Returns:
non-null reference to a DOM helper.

setDOMHelper

public void setDOMHelper(DOMHelper helper)
Set the DOMHelper associated with this execution context.

Parameters:
helper - reference to a dom helper to be associated with this execution context.

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.

getContextNodeList

public final ContextNodeList 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(ContextNodeList 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.


getCurrentNode

public final org.w3c.dom.Node getCurrentNode()
Get the current context node.

Returns:
the current node.

pushCurrentNodeAndExpression

public final void pushCurrentNodeAndExpression(org.w3c.dom.Node cn,
                                               org.w3c.dom.Node 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.


pushCurrentNode

public final void pushCurrentNode(org.w3c.dom.Node n)
Set the current context node.

Parameters:
n - the current node.

popCurrentNode

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


getCurrentExpressionNode

public final org.w3c.dom.Node 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(org.w3c.dom.Node 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.

pushIteratorRoot

public final void pushIteratorRoot(org.w3c.dom.Node n)
Set the current location path iterator root.


popIteratorRoot

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


getIteratorRoot

public final org.w3c.dom.Node getIteratorRoot()
Get the current location path iterator root.


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()


getContextNode

public final org.w3c.dom.Node getContextNode()
Get the current context node.
Specified by:
getContextNode in interface ExpressionContext

Returns:
The current context node.

getContextNodes

public final org.w3c.dom.traversal.NodeIterator getContextNodes()
Get the current context node list.
Specified by:
getContextNodes in interface ExpressionContext

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

toNumber

public final double toNumber(org.w3c.dom.Node n)
Get the value of a node as a number.
Specified by:
toNumber in interface ExpressionContext

Parameters:
n - Node to be converted to a number. May be null.
Returns:
value of n as a number.

toString

public final java.lang.String toString(org.w3c.dom.Node n)
Get the value of a node as a string.
Specified by:
toString in interface ExpressionContext

Parameters:
n - Node to be converted to a string. May be null.
Returns:
value of n as a string, or an empty string if n is null.

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

WebLogic classes and methods that do not appear in this reference are not public and are not supported.