net.sf.saxon.sxpath
public class XPathDynamicContext extends java.lang.Object
This object is always created via the method
XPathExpression.createDynamicContext(net.sf.saxon.om.Item)
Modifier | Constructor and Description |
---|---|
protected |
XPathDynamicContext(XPathContextMajor contextObject,
SlotManager stackFrameMap) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkExternalVariables(SlotManager stackFrameMap,
int numberOfExternals)
Check that all external variables have been given a value
|
Item |
getContextItem()
Get the context item
|
XPathContext |
getXPathContextObject()
For system use: get the wrapped XPathContext object
|
void |
setContextItem(Item item)
Set the context item for evaluation of the XPath Expression
|
void |
setContextNode(javax.xml.transform.Source source)
Set the context item to a node derived from a supplied Source object.
|
void |
setVariable(XPathVariable variable,
ValueRepresentation value)
Set the value of an external variable used within the XPath expression
|
protected XPathDynamicContext(XPathContextMajor contextObject, SlotManager stackFrameMap)
public void setContextNode(javax.xml.transform.Source source) throws XPathException
NodeInfo
interface, representing a node in a tree, is one such
implementation; others include StreamSource
,
SAXSource
, and DOMSource
source
- The source object representing the node that will be used as the context itemXPathException
- if a failure occurs reading or parsing a Source object to build an input tree,
or if the source is a document that was built under the wrong configurationpublic void setContextItem(Item item) throws XPathException
item
- the context itemXPathException
- if the node is in a document that was built under the wrong configurationpublic Item getContextItem()
public void setVariable(XPathVariable variable, ValueRepresentation value) throws XPathException
variable
- the object representing the variable, as returned by the
XPathEvaluator.declareVariable(String, String)
method.
Note that setting the value of a variable does not modify the XPathVariable
object itself, which means that this method is thread-safe.value
- The value of the variable.XPathException
- if the supplied value does not conform to the required type of the
variable; or if the supplied value contains a node that does not belong to this Configuration
(or another Configuration that shares the same namePool)public XPathContext getXPathContextObject()
protected void checkExternalVariables(SlotManager stackFrameMap, int numberOfExternals) throws XPathException
stackFrameMap
- describes the stack framenumberOfExternals
- the number of variables that need to be suppliedXPathException
- if required variables have not been given a value