Package org.exolab.adaptx.xslt
Class ProcessorState
- java.lang.Object
-
- org.exolab.adaptx.xpath.XPathContext
-
- org.exolab.adaptx.xslt.ProcessorState
-
public class ProcessorState extends XPathContext
The current RuleProcessor environment.- Version:
- $Revision: 4778 $ $Date: 2004-09-28 22:57:15 +0200 (Tue, 28 Sep 2004) $
- Author:
- Keith Visco
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringECMASCRIPTstatic java.lang.StringJPYTHON
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassociateNamespace(java.lang.String nsPrefix, java.lang.String nsURI)Associates a namespace with the given prefix,java.lang.StringgenerateId(XPathNode node)Creates a unique identifier for the given nodeAttributeValueTemplategetAttributeValueTemplate(java.lang.String avtString)Returns the value of the given String as an AttributeValueTemplateXPathNodegetCurrentNode()Returns the "current" node The current node, is different than the context node, as the context node may change during the evaluation of an xpath expression, the current node does not.int[]getDocumentOrder(XPathNode node)Returns the document order of the given node.java.lang.StringgetDocumentURI(XPathNode node)Returns the document URI of the given XPathNode, or null if it's not foundXPathNodegetElementById(XPathNode root, java.lang.String id)Returns the element associated with the given identifier.ErrorObservergetErrorObserver()Returns the ErrorObserver to report errors toXPathFunctiongetFunction(java.lang.String name)Returns the XPathFunction with the given name and belonging to the given namespace.XPathFunctiongetFunction(java.lang.String namespace, java.lang.String name)Returns the XPathFunction with the given name and belonging to the given namespace.java.lang.StringgetNamespaceURI(java.lang.String prefix)Returns the namespace associated with the given prefix.XPathNodegetNode()Returns the context node of this XPathContextNodeSetgetNodeSet()Returns the current context node-set.java.lang.StringgetParameter(java.lang.String name)Returns the parameter value associated with the given name.ScopedVariableSetgetParameters()intgetPosition()Returns the position of the context node.java.lang.StringgetProperty(java.lang.String name)Returns the Property value associated with the given name.intgetSize()Returns the size of the context.URILocationgetStylesheetLocation()URIResolvergetURIResolver()Returns the URIResolver for resolving all URIs.XPathResultgetVariable(java.lang.String name)Returns the XPath result bound to the given variable name.QuickStackgetXMLSpaceModes()Returns the stack of XML space modesbooleanisFunctionAvailable(java.lang.String name, java.lang.String namespace)Returns true if a function with the given name exists within the given namespace.booleanisXSLTNamespace(java.lang.String prefixOrURI)Determines if the given prefix or URI maps to the XSLT namespaceXPathNodepopCurrentNode()Removes the current node from the top of the stack The current node, is different than the context node, as the context node may change during the evaluation of an xpath expression, the current node does not.ResultHandlerpopHandler()Removes and returns the ResultHandler from the top of the ResultHandler stack.NodeSetpopNodeSet()Removes and returns the current NodeSet from the context stackvoidpushCurrentNode(XPathNode node)Adds the given node to the top of the "current" node Stack.voidpushHandler(ResultHandler handler)Pushes a new ResultHandler to the top of the ResultHandler stack.voidpushNodeSet(NodeSet nodeSet)Pushes the given nodeSet onto the context stackvoidsetNodeSet(NodeSet nodeSet, int position)Sets the given node-set as the context node-set for this XPathContextvoidsetPosition(int position)Sets the position of the context node within the context node-set-
Methods inherited from class org.exolab.adaptx.xpath.XPathContext
addNamespaceBinding, newContext, newContext, newNodeSet, newNodeSet, newNodeSet
-
-
-
-
Field Detail
-
ECMASCRIPT
public static final java.lang.String ECMASCRIPT
- See Also:
- Constant Field Values
-
JPYTHON
public static final java.lang.String JPYTHON
- See Also:
- Constant Field Values
-
-
Method Detail
-
associateNamespace
public void associateNamespace(java.lang.String nsPrefix, java.lang.String nsURI)Associates a namespace with the given prefix,- Parameters:
nsPrefix- the namespace prefixnsURI- the namespace URI to associate
-
generateId
public java.lang.String generateId(XPathNode node)
Creates a unique identifier for the given node- Returns:
- the String that is a unique identifier for the given node
-
getCurrentNode
public XPathNode getCurrentNode()
Returns the "current" node The current node, is different than the context node, as the context node may change during the evaluation of an xpath expression, the current node does not. Basically it's the first context node during the beginning of an xpath evalation.- Returns:
- the "current" node
- See Also:
popCurrentNode(),pushCurrentNode(org.exolab.adaptx.xpath.XPathNode)
-
getErrorObserver
public ErrorObserver getErrorObserver()
Returns the ErrorObserver to report errors to- Returns:
- the ErrorObserver to report errors to
-
getStylesheetLocation
public URILocation getStylesheetLocation()
-
getParameter
public java.lang.String getParameter(java.lang.String name)
Returns the parameter value associated with the given name.- Parameters:
name- the name of the parameter to retrieve the value of- Returns:
- the parameter value associated with the given name.
-
getProperty
public java.lang.String getProperty(java.lang.String name)
Returns the Property value associated with the given name. All property names without a namespace are defaulted to the System evironment scope.- Parameters:
name- the name of the property to get the value of- Returns:
- the Property value associated with the given name.
-
getXMLSpaceModes
public QuickStack getXMLSpaceModes()
Returns the stack of XML space modes
-
getNamespaceURI
public java.lang.String getNamespaceURI(java.lang.String prefix)
Returns the namespace associated with the given prefix. A namespace can be associated with a given prefix via the XSLT document being processed, or using #associateNamespace method- Overrides:
getNamespaceURIin classXPathContext- Parameters:
prefix- the prefix of the namespace to return- Returns:
- the namespace prefix or null if none found.
-
getURIResolver
public URIResolver getURIResolver()
Returns the URIResolver for resolving all URIs.- Returns:
- the URIResolver for resolving all URIs.
-
isFunctionAvailable
public boolean isFunctionAvailable(java.lang.String name, java.lang.String namespace)Returns true if a function with the given name exists within the given namespace.- Returns:
- true if a function with the given name exists
-
isXSLTNamespace
public boolean isXSLTNamespace(java.lang.String prefixOrURI)
Determines if the given prefix or URI maps to the XSLT namespace- Parameters:
prefixOrURI- the prefix or URI to compare with the XSLT namespace- Returns:
- true if the given prefix or URI maps to the XSLT namespace
-
popHandler
public ResultHandler popHandler()
Removes and returns the ResultHandler from the top of the ResultHandler stack.- Returns:
- the ResultHandler that was at the top of the stack.
-
pushHandler
public void pushHandler(ResultHandler handler)
Pushes a new ResultHandler to the top of the ResultHandler stack.- Parameters:
handler- the ResultHandler to push to the top of the stack.
-
popCurrentNode
public XPathNode popCurrentNode()
Removes the current node from the top of the stack The current node, is different than the context node, as the context node may change during the evaluation of an xpath expression, the current node does not. Basically it's the first context node during the beginning of an xpath evalation.- Returns:
- the current node.
- See Also:
pushCurrentNode(org.exolab.adaptx.xpath.XPathNode),getCurrentNode()
-
pushCurrentNode
public void pushCurrentNode(XPathNode node)
Adds the given node to the top of the "current" node Stack. The current node, is different than the context node, as the context node may change during the evaluation of an xpath expression, the current node does not. Basically it's the first context node during the beginning of an xpath evalation.- Parameters:
node- the new current node- See Also:
popCurrentNode(),getCurrentNode()
-
pushNodeSet
public void pushNodeSet(NodeSet nodeSet)
Pushes the given nodeSet onto the context stack- Parameters:
nodeSet- the nodeSet ot push onto the stack
-
popNodeSet
public NodeSet popNodeSet()
Removes and returns the current NodeSet from the context stack- Returns:
- the current NodeSet from the context stack
-
getAttributeValueTemplate
public AttributeValueTemplate getAttributeValueTemplate(java.lang.String avtString) throws XPathException
Returns the value of the given String as an AttributeValueTemplate- Throws:
InvalidExprException- when the String argument is not a valid AttrubueValueTemplateXPathException
-
getFunction
public XPathFunction getFunction(java.lang.String name)
Returns the XPathFunction with the given name and belonging to the given namespace.- Parameters:
namespace- the namespace of the functionname- the name of the function- Returns:
- the XPathFunction with the given name
-
getParameters
public ScopedVariableSet getParameters()
-
getNode
public XPathNode getNode()
Returns the context node of this XPathContext- Overrides:
getNodein classXPathContext- Returns:
- the context node
-
getPosition
public int getPosition()
Returns the position of the context node. The position is a value between zero and the context size minus one. One must be added in order to obtain a value XPath position.- Overrides:
getPositionin classXPathContext- Returns:
- The position of the context node
- See Also:
getSize()
-
getSize
public int getSize()
Returns the size of the context.- Overrides:
getSizein classXPathContext- Returns:
- The size of the context
-
getNodeSet
public NodeSet getNodeSet()
Returns the current context node-set.- Overrides:
getNodeSetin classXPathContext- Returns:
- The current context node-set
-
setNodeSet
public void setNodeSet(NodeSet nodeSet, int position)
Sets the given node-set as the context node-set for this XPathContext- Overrides:
setNodeSetin classXPathContext- Parameters:
nodeSet- the node-set to use as the context node-set.position- the position of the context node
-
getDocumentURI
public java.lang.String getDocumentURI(XPathNode node)
Returns the document URI of the given XPathNode, or null if it's not found
-
getDocumentOrder
public int[] getDocumentOrder(XPathNode node)
Returns the document order of the given node.- Overrides:
getDocumentOrderin classXPathContext- Returns:
- The document order of the given node
-
getElementById
public XPathNode getElementById(XPathNode root, java.lang.String id)
Returns the element associated with the given identifier. Locates the element underneath the specified root node.- Overrides:
getElementByIdin classXPathContext- Parameters:
root- The root nodeid- The element's identifier- Returns:
- The first element in document order with the given identifier, or null if no such element was found
-
getVariable
public XPathResult getVariable(java.lang.String name)
Returns the XPath result bound to the given variable name. Returns null if the variable was not set.- Overrides:
getVariablein classXPathContext- Parameters:
name- The variable name- Returns:
- The variable's value
-
getFunction
public XPathFunction getFunction(java.lang.String namespace, java.lang.String name)
Returns the XPathFunction with the given name and belonging to the given namespace.- Overrides:
getFunctionin classXPathContext- Parameters:
namespace- the namespace of the functionname- the name of the function- Returns:
- the XPathFunction with the given name
-
setPosition
public void setPosition(int position)
Sets the position of the context node within the context node-set- Overrides:
setPositionin classXPathContext- Parameters:
the- position of the context node within the context node-set- Throws:
java.lang.IndexOutOfBoundsException- when the position is not within the bounds of the context node-set.
-
-