| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
<html> |
| 9 |
|
| 10 |
<head> |
| 11 |
<title>Package overview for net.sf.saxon.expr</title> |
| 12 |
</head> |
| 13 |
|
| 14 |
<body> |
| 15 |
|
| 16 |
<p>This package provides classes associated with XPath expression handling. Generally, these |
| 17 |
classes are not intended to be used directly by user-written applications; the API for XPath |
| 18 |
evaluation is now provided by classes in the package <code>net.sf.saxon.xpath</code></p> |
| 19 |
|
| 20 |
<p>The principal classes are:</p> |
| 21 |
|
| 22 |
<p><b>Expression</b>:<br> |
| 23 |
This represents an XPath Expression. There is a static method Expression.make() which is |
| 24 |
used to construct an Expression from a String (it is a factory method rather than a |
| 25 |
constructor, because it typically returns some subclass of Expression according |
| 26 |
to the syntax supplied). Subclasses of Expression represent different kinds of expression |
| 27 |
such as StringExpression and BooleanExpression. What they all have in common is an evaluate() |
| 28 |
method, which evaluates the expression in a given context to yield a Value, and an iterate() method, |
| 29 |
which treats the result of the expression as a sequence, and iterates over the items in the sequence.</p> |
| 30 |
|
| 31 |
<p><b>ExpressionParser</b>:<br> |
| 32 |
This class does the work of parsing both Expressions and Patterns. Applications should not call |
| 33 |
it directly. It uses the class Tokenizer for lexical analysis.</p> |
| 34 |
|
| 35 |
<p><b>StaticContext</b>:<br> |
| 36 |
This interface defines the information available at the time an expression is being parsed. This |
| 37 |
includes the names of variables, the bindings of namespace prefixes, the functions that are available, |
| 38 |
the names of collating sequences, and so on. When an XPath expression appears in a stylesheet, the |
| 39 |
class <code>net.sf.saxon.style.ExpressionContext</code> provides the StaticContext. For a free-standing XPath |
| 40 |
expression, the class <code>net.sf.saxon.xpath.StandaloneContext</code> is available, though a user-written |
| 41 |
class that implements <code>StaticContext</code> can also be used.</p> |
| 42 |
|
| 43 |
<p><b>XPathContext</b>:<br> |
| 44 |
This class defines the context information available at run-time, for example the context node, position, |
| 45 |
and size. (It actually does this by wrapping a SequenceIterator that represents the current sequence.) |
| 46 |
When expressions are used during an XSLT transformation, the XPathContext also provides access to the |
| 47 |
Controller, which contains all the context information about XSLT processing (for example the current template, |
| 48 |
the current group, and so on).</p> |
| 49 |
|
| 50 |
<p>Most of the classes in this package represent individual syntactic constructs found in XPath or XQuery expressions: |
| 51 |
for example <code>ValueComparison</code>, <code>UserFunctionCall</code>, and <code>RootExpression</code>. The |
| 52 |
objects |
| 53 |
that instantiate these classes form the nodes on the Abstract Syntax Tree constructed by the compiler and modified |
| 54 |
by the optimizer; at run-time their methods are used to drive a pipelined evaluation of the expression.</p> |
| 55 |
|
| 56 |
<p>The distinction between the compiled form of XSLT instructions and the compiled form of XPath expressions has |
| 57 |
become blurred. Generally, the compiled form of instructions is in the package <code>net.sf.saxon.instruct</code> |
| 58 |
(this includes expressions in XQuery that are equivalent to XSLT instructions, for example element constructors). |
| 59 |
However, some constructs such as conditional expressions now exist in both languages and may generate the same |
| 60 |
run-time constructs.</p> |
| 61 |
|
| 62 |
</body> |
| 63 |
</html> |