Project

Profile

Help

How to connect?
Download (3.4 KB) Statistics
| Branch: | Tag: | Revision:

he / latest9.3 / hej / net / sf / saxon / expr / package.html @ 797dc683

1
<html>
2

    
3
<head>
4
<title>Package overview for net.sf.saxon.expr</title>
5
</head>
6

    
7
<body>
8

    
9
<p>This package provides classes associated with XPath expression handling. Generally, these
10
classes are not intended to be used directly by user-written applications; the API for XPath
11
evaluation is now provided by classes in the package <code>net.sf.saxon.xpath</code></p>
12

    
13
<p>The principal classes are:</p>
14

    
15
<p><b>Expression</b>:<br>
16
This represents an XPath Expression. There is a static method Expression.make() which is
17
used to construct an Expression from a String (it is a factory method rather than a
18
 constructor, because it typically returns some subclass of Expression according
19
  to the syntax supplied). Subclasses of Expression represent different kinds of expression
20
  such as StringExpression and BooleanExpression. What they all have in common is an evaluate()
21
  method, which evaluates the expression in a given context to yield a Value, and an iterate() method,
22
  which treats the result of the expression as a sequence, and iterates over the items in the sequence.</p>
23

    
24
<p><b>ExpressionParser</b>:<br>
25
This class does the work of parsing both Expressions and Patterns. Applications should not call
26
it directly. It uses the class Tokenizer for lexical analysis.</p>
27

    
28
<p><b>StaticContext</b>:<br>
29
This interface defines the information available at the time an expression is being parsed. This
30
includes the names of variables, the bindings of namespace prefixes, the functions that are available,
31
the names of collating sequences, and so on. When an XPath expression appears in a stylesheet, the
32
class <code>net.sf.saxon.style.ExpressionContext</code> provides the StaticContext. For a free-standing XPath
33
expression, the class <code>net.sf.saxon.xpath.StandaloneContext</code> is available, though a user-written
34
class that implements <code>StaticContext</code> can also be used.</p>
35

    
36
<p><b>XPathContext</b>:<br>
37
This class defines the context information available at run-time, for example the context node, position,
38
and size. (It actually does this by wrapping a SequenceIterator that represents the current sequence.)
39
When expressions are used during an XSLT transformation, the XPathContext also provides access to the
40
Controller, which contains all the context information about XSLT processing (for example the current template,
41
the current group, and so on).</p>
42

    
43
<p>Most of the classes in this package represent individual syntactic constructs found in XPath or XQuery expressions:
44
for example <code>ValueComparison</code>, <code>UserFunctionCall</code>, and <code>RootExpression</code>. The objects
45
that instantiate these classes form the nodes on the Abstract Syntax Tree constructed by the compiler and modified
46
by the optimizer; at run-time their methods are used to drive a pipelined evaluation of the expression.</p>
47

    
48
<p>The distinction between the compiled form of XSLT instructions and the compiled form of XPath expressions has
49
become blurred. Generally, the compiled form of instructions is in the package <code>net.sf.saxon.instruct</code>
50
(this includes expressions in XQuery that are equivalent to XSLT instructions, for example element constructors).
51
However, some constructs such as conditional expressions now exist in both languages and may generate the same
52
run-time constructs.</p>
53

    
54
<hr>
55

    
56
<p align="center"><i>Michael H. Kay<br>
57
Saxonica Limited<br/>
58
9 February 2005</i></p>
59
</body>
60
</html>
(124-124/124)