public class XPathExpression
extends java.lang.Object
XPathEvaluator
class.
It is modelled on the XPath API defined in JAXP 1.3, but is cut down to remove any dependencies on JAXP 1.3,
making it suitable for use on vanilla JDK 1.4 installations.??? | ?????? |
---|---|
protected |
XPathExpression(XPathEvaluator evaluator,
Expression exp)
The constructor is protected, to ensure that instances can only be
created using the createExpression() method of XPathEvaluator
|
?????? | ????? |
---|---|
XPathDynamicContext |
createDynamicContext(Item contextItem)
Create a dynamic context suitable for evaluating this expression
|
boolean |
effectiveBooleanValue(XPathDynamicContext context)
Evaluate the expression, returning its effective boolean value
|
java.util.List |
evaluate(javax.xml.transform.Source source)
Execute a prepared XPath expression, returning the results as a List in which items have been converted
to the appropriate Java object.
|
java.util.List |
evaluate(XPathDynamicContext context)
Execute the expression, returning the result as a List, whose members will be instances
of the class
Item |
java.lang.Object |
evaluateSingle(javax.xml.transform.Source source)
Execute a prepared XPath expression, returning the first item in the result.
|
Item |
evaluateSingle(XPathDynamicContext context)
Execute the expression, returning the result as a single
Item
If the result of the expression is a sequence containing more than one item, items after
the first are discarded. |
Expression |
getInternalExpression()
Low-level method to get the internal Saxon expression object.
|
SequenceIterator |
iterate(XPathDynamicContext context)
Execute the expression, returning the result as a
SequenceIterator , whose members will be instances
of the class Item
Note that if evaluation of the expression fails with a dynamic error, this will generally
be reported in the form of an exception thrown by the next() method of the SequenceIterator |
SequenceIterator |
rawIterator(javax.xml.transform.Source source)
????
since 8.9 - use
iterate(net.sf.saxon.sxpath.XPathDynamicContext) |
protected void |
setStackFrameMap(SlotManager map,
int numberOfExternalVariables)
Define the number of slots needed for local variables within the expression
|
protected XPathExpression(XPathEvaluator evaluator, Expression exp)
evaluator
- the creating XPathEvaluatorexp
- the internal representation of the compiled expressionprotected void setStackFrameMap(SlotManager map, int numberOfExternalVariables)
map
- the stack frame map identifying all the variables used by the expression, both
those declared internally, and references to variables declared externallynumberOfExternalVariables
- the number of slots in the stack frame allocated to
externally-declared variables. These must be assigned a value before execution startspublic XPathDynamicContext createDynamicContext(Item contextItem)
contextItem
- the initial context item, which may be null if no
context item is required, or if it is to be supplied laterpublic SequenceIterator iterate(XPathDynamicContext context) throws XPathException
SequenceIterator
, whose members will be instances
of the class Item
Note that if evaluation of the expression fails with a dynamic error, this will generally
be reported in the form of an exception thrown by the next() method of the SequenceIterator
context
- the XPath dynamic contextXPathException
public java.util.List evaluate(XPathDynamicContext context) throws XPathException
Item
context
- the XPath dynamic contextXPathException
public Item evaluateSingle(XPathDynamicContext context) throws XPathException
Item
If the result of the expression is a sequence containing more than one item, items after
the first are discarded. If the result is an empty sequence, the method returns null.context
- the XPath dynamic contextXPathException
public boolean effectiveBooleanValue(XPathDynamicContext context) throws XPathException
context
- the XPath dynamic contextXPathException
- if a dynamic error occurs, or if the result is a value for which
no effective boolean value is definedpublic java.util.List evaluate(javax.xml.transform.Source source) throws XPathException
source
- the document or other node against which the XPath expression
will be evaluated. This may be a Saxon NodeInfo object, representing a node in an
existing tree, or it may be any kind of JAXP Source object such as a StreamSource
SAXSource or DOMSource. For the way in which the source document is built, see
Configuration.buildDocument(javax.xml.transform.Source)
XPathException
public java.lang.Object evaluateSingle(javax.xml.transform.Source source) throws XPathException
source
- the document or other node against which the XPath expression
will be evaluated. This may be a Saxon NodeInfo object, representing a node in an
existing tree, or it may be any kind of JAXP Source object such as a StreamSource
SAXSource or DOMSource. For the way in which the source document is built, see
Configuration.buildDocument(javax.xml.transform.Source)
XPathException
public SequenceIterator rawIterator(javax.xml.transform.Source source) throws XPathException
iterate(net.sf.saxon.sxpath.XPathDynamicContext)
source
- the document or other node against which the XPath expression
will be evaluated. This may be a Saxon NodeInfo object, representing a node in an
existing tree, or it may be any kind of JAXP Source object such as a StreamSource
SAXSource or DOMSource. For the way in which the source document is built, see
Configuration.buildDocument(javax.xml.transform.Source)
XPathException
public Expression getInternalExpression()