Package net.sf.saxon.expr

This package provides classes associated with XPath expression handling.

See:
          Description

Interface Summary
Binding Binding is a interface used to represent the run-time properties and methods associated with a variable: specifically, a method to get the value of the variable.
BindingReference BindingReference is a interface used to mark references to a variable declaration.
CodeGeneratorService  
ComparisonExpression Interface implemented by expressions that perform a comparison
Container A Container is something other than an expression that can act as the container of an expression.
ContextMappingFunction ContextMappingFunction is an interface that must be satisfied by an object passed to a ContextMappingIterator.
ContextSwitchingExpression Interface implemented by expressions that switch the context, for example A/B or A[B]
EvaluableItem This interface is a simple subset of the Expression interface, that provides a single method to evaluate the result of an expression as a single item
ExpressionParser.FLWORClause  
ItemMappingFunction ItemMappingFunction is an interface that must be satisfied by an object passed to a ItemMappingIterator.
LastPositionFinder A LastPositionFinder is an interface implemented by any SequenceIterator that is able to return the position of the last item in the sequence.
MappingExpression Interface implemented by an expression that takes a single sequence as input and returns a sequence as output; this method delivers an iterator that maps the input to the output.
MappingFunction MappingFunction is an interface that must be satisfied by an object passed to a MappingIterator.
Negatable This interface is implemented by expressions that returns a boolean value, and returns an expression whose result is the negated boolean value
PendingUpdateList A PendingUpdateList is created by updating expressions in XQuery Update.
ReversibleIterator A ReversibleIterator is an interface implemented by any SequenceIterator that is able to deliver items in reverse order (or to supply another iterator that can do so).
SequenceIterable This interface is a simple subset of the Expression interface, that provides a single method to evaluate the result of an expression as a sequence
StatefulMappingFunction MappingFunction is an interface that must be satisfied by an object passed to a MappingIterator.
StaticContext A StaticContext contains the information needed while an expression or pattern is being parsed.
VariableDeclaration Generic interface representing a variable declaration in the static context of an XPath expression.
XPathContext This class represents a context in which an XPath expression is evaluated.
 

Class Summary
AppendIterator Iterator that concatenates the results of two supplied iterators
ArithmeticExpression Arithmetic Expression: an expression using one of the operators plus, minus, multiply, div, idiv, mod.
ArithmeticExpression10 Arithmetic Expression: an expression using one of the operators plus, minus, multiply, div, idiv, mod, in backwards compatibility mode: see ArithmeticExpression for the non-backwards compatible case.
Assignation Assignation is an abstract superclass for the kinds of expression that declare range variables: for, some, and every.
AtomicMappingExpression An atomic mapping expression is a slash expression A/B where B has a static type that is an atomic type.
AtomicSequenceConverter An AtomicSequenceConverter is an expression that performs a cast on each member of a supplied sequence
Atomizer An Atomizer is an expression corresponding essentially to the fn:data() function: it maps a sequence by replacing nodes with their typed values
Atomizer.AtomizingFunction Implement the mapping function.
AxisAtomizingIterator This iterator returns a sequence of atomic values, the result of atomizing the sequence of nodes returned by an underlying AxisIterator.
AxisExpression An AxisExpression is always obtained by simplifying a PathExpression.
BinaryExpression Binary Expression: a numeric or boolean expression consisting of the two operands and an operator
BooleanExpression Boolean expression: two truth values combined using AND or OR.
Calculator This class evaluates arithmetic expressions; it acts as a helper class to the ArithmeticExpression class.
CardinalityChecker A CardinalityChecker implements the cardinality checking of "treat as": that is, it returns the supplied sequence, checking that its cardinality is correct
CardinalityCheckingIterator CardinalityCheckingIterator returns the items in an underlying sequence unchanged, but checks that the number of items conforms to the required cardinality.
CastableExpression Castable Expression: implements "Expr castable as atomic-type?".
CastExpression Cast Expression: implements "cast as data-type ( expression )".
CollationMap This object maps collation URIs to collations.
CompareToIntegerConstant This class implements a comparison of a numeric value to an integer constant using one of the operators eq, ne, lt, gt, le, ge.
ContextItemExpression This class represents the expression "(dot)", which always returns the context item.
ContextMappingIterator ContextMappingIterator merges a sequence of sequences into a single flat sequence.
CurrentItemExpression The expression is generated when compiling the current() function in XSLT.
DifferenceEnumeration An enumeration representing a nodeset that is teh difference of two other NodeSets.
EagerLetExpression An EagerLetExpression is the same as a LetExpression except that the variable is evaluated using eager evaluation rather than lazy evaluation.
EarlyEvaluationContext This class is an implementation of XPathContext used when evaluating constant sub-expressions at compile time.
ErrorExpression Error expression: this expression is generated when the supplied expression cannot be parsed, and the containing element enables forwards-compatible processing.
ErrorIterator A SequenceIterator that throws an exception as soon as its next() method is called.
EveryItemMappingIterator EveryItemMappingIterator applies a mapping function to each item in a sequence.
Expression Interface supported by an XPath expression.
ExpressionLocation Class to hold details of the location of an expression, of an error in a source file, etc.
ExpressionParser Parser for XPath expressions and XSLT patterns.
ExpressionParser.ForClause  
ExpressionParser.TemporaryContainer  
ExpressionTool This class, ExpressionTool, contains a number of useful static methods for manipulating expressions.
ExpressionVisitor The ExpressionVisitor supports the various phases of processing of an expression tree which require a recursive walk of the tree structure visiting each node in turn.
FilterExpression A FilterExpression contains a base expression and a filter predicate, which may be an integer expression (positional filter), or a boolean expression (qualifier)
FilterIterator A FilterIterator filters an input sequence using a filter expression.
FilterIterator.NonNumeric Subclass to handle the common special case where it is statically known that the filter cannot return a numeric value
FirstItemExpression A FirstItemExpression returns the first item in the sequence returned by a given base expression
ForExpression A ForExpression maps an expression over a sequence.
ForExpression.EventMappingAction The EventMappingAction represents the action to be taken for each item in the source sequence.
ForExpression.MappingAction The MappingAction represents the action to be taken for each item in the source sequence.
FunctionCall Abstract superclass for calls to system-defined and user-defined functions
GeneralComparison GeneralComparison: a boolean expression that compares two expressions for equals, not-equals, greater-than or less-than.
GeneralComparison10 GeneralComparison10: a boolean expression that compares two expressions for equals, not-equals, greater-than or less-than.
IdentityComparison IdentityComparison: a boolean expression that compares two nodes for equals, not-equals, greater-than or less-than based on identity and document ordering
InstanceOfExpression InstanceOf Expression: implements "Expr instance of data-type"
IntegerRangeTest An IntegerRangeTest is an expression of the form E = N to M where E is numeric, and N and M are both expressions of type integer.
IntersectionEnumeration An enumeration representing a nodeset that is an intersection of two other NodeSets.
IsLastExpression A position() eq last() expression, generated by the optimizer.
ItemChecker A ItemChecker implements the item type checking of "treat as": that is, it returns the supplied sequence, checking that all its items are of the correct type
ItemMappingIterator ItemMappingIterator applies a mapping function to each item in a sequence.
JPConverter This class together with its embedded subclasses handles conversion from Java values to XPath values.
JPConverter.FromBigDecimal  
JPConverter.FromBigInteger  
JPConverter.FromBoolean  
JPConverter.FromBooleanArray  
JPConverter.FromByte  
JPConverter.FromByteArray  
JPConverter.FromCharacter  
JPConverter.FromCharArray  
JPConverter.FromCollection  
JPConverter.FromDate  
JPConverter.FromDouble  
JPConverter.FromDoubleArray  
JPConverter.FromFloat  
JPConverter.FromFloatArray  
JPConverter.FromInt  
JPConverter.FromIntArray  
JPConverter.FromLong  
JPConverter.FromLongArray  
JPConverter.FromObjectArray  
JPConverter.FromQName  
JPConverter.FromSequenceIterator  
JPConverter.FromShort  
JPConverter.FromShortArray  
JPConverter.FromSource  
JPConverter.FromString  
JPConverter.FromURI  
JPConverter.FromValueRepresentation  
JPConverter.WrapExternalObject  
LastItemExpression A LastItemExpression returns the last item in the sequence returned by a given base expression.
LazyExpression A LazyExpression is an expression that forces lazy evaluation: it must not be evaluated eagerly, because a failure must not be reported unless the value is actually referenced.
LetExpression A LetExpression is modelled on the XQuery syntax let $x := expr return expr.
Literal A Literal is an expression whose value is constant: it is a class that implements the Expression interface as a wrapper around a Value.
LocalVariableReference Variable reference: a reference to a local variable.
MappingIterator MappingIterator merges a sequence of sequences into a single flat sequence.
MonoIterator An iterator over a single object (typically a sub-expression of an expression)
MultiIterator An iterator that combines the results of a sequence of iterators
NegateExpression Negate Expression: implements the unary minus operator.
NumericPromoter A NumericPromoter performs numeric promotion on each item in a supplied sequence.
Optimizer This class performs optimizations that vary between different versions of the Saxon product.
PairIterator An iterator over a pair of objects (typically sub-expressions of an expression)
ParentNodeExpression Class ParentNodeExpression represents the XPath expression ".." or "parent::node()"
PathExpression An expression that establishes a set of nodes by following relationships between nodes in the document.
PathMap A PathMap is a description of all the paths followed by an expression.
PathMap.PathMapArc An arc joining two nodes in the path map.
PathMap.PathMapNode A node in the path map.
PathMap.PathMapNodeSet A (mutable) set of nodes in the path map
PathMap.PathMapRoot A root node in the path map.
PatternMatchExpression A PatternMatchExpression is a boolean expression that returns true if and only if the context node matches a given pattern.
PJConverter This class together with its embedded subclasses handles conversion from XPath values to Java values
PJConverter.AnyURIValueToURI  
PJConverter.AnyURIValueToURL  
PJConverter.Atomic Converter for use when the source object is an atomic value, but nothing more is known statically.
PJConverter.BooleanValueToBoolean  
PJConverter.CalendarValueToCalendar  
PJConverter.CalendarValueToDate  
PJConverter.General General-purpose converter when nothing more specific is available.
PJConverter.Identity  
PJConverter.IntegerValueToBigInteger  
PJConverter.IntegerValueToByte  
PJConverter.IntegerValueToChar  
PJConverter.IntegerValueToInt  
PJConverter.IntegerValueToLong  
PJConverter.IntegerValueToShort  
PJConverter.NumericValueToBigDecimal  
PJConverter.NumericValueToDouble  
PJConverter.NumericValueToFloat  
PJConverter.QualifiedNameValueToQName  
PJConverter.StringValueToChar  
PJConverter.StringValueToString  
PJConverter.ToArray Converter for use when the target class is an array
PJConverter.ToCollection Converter for use when the target class is a collection class.
PJConverter.ToNull  
PJConverter.ToSequenceExtent  
PJConverter.ToSequenceIterator  
PJConverter.UnwrapExternalObject  
PositionVariable Represents the defining occurrence of the position variable in a for expression within an expression, for example the $p in "for $x at $p in ...".
PromoteToDouble Expression that performs numeric promotion to xs:double
PromoteToFloat Expression that performs numeric promotion to xs:double
PromotionOffer PromotionOffer is an object used transiently during compilation of an expression.
QuantifiedExpression A QuantifiedExpression tests whether some/all items in a sequence satisfy some condition.
RangeExpression A RangeExpression is an expression that represents an integer sequence as a pair of end-points (for example "x to y").
RangeIterator An Iterator that produces numeric values in a monotonic sequence, ascending or descending.
ReverseRangeIterator Iterator that produces numeric values in a monotonic sequence, ascending or descending.
RoleLocator A RoleLocator identifies the role in which an expression is used, for example as the third argument of the concat() function.
RootExpression An expression whose value is always a set of nodes containing a single node, the document root.
SimpleExpression An abstract implementation of Expression designed to make it easy to implement new expressions, in particular, expressions to support extension instructions.
SingleNodeExpression A node set expression that will always return zero or one nodes
SingletonAtomizer A SingletonAtomizer combines the functions of an Atomizer and a CardinalityChecker: it is used to atomize a sequence of nodes, checking that the result of the atomization contains zero or one atomic values.
SingletonComparison Class to handle comparisons of singletons.
SlashExpression A slash expression is any expression using the binary slash operator "/".
StackFrame This class represents a stack frame holding details of the variables used in a function or in an XSLT template.
StaticProperty This class contains constants identifying dependencies that an XPath expression might have on its context.
StringLiteral Subclass of Literal used specifically for string literals, as this is a common case
StringTokenIterator StringTokenIterator: breaks a string up into tokens, and returns the tokens as a sequence of strings.
SubsequenceIterator A SubsequenceIterator selects a subsequence of a sequence
SuppliedParameterReference Supplied parameter reference: this is an internal expression used to refer to the value of the n'th parameter supplied on a template call (apply-templates).
TailCallLoop A TailCallLoop wraps the body of a function that contains tail-recursive function calls.
TailExpression A TailExpression represents a FilterExpression of the form EXPR[position() > n] Here n is usually 2, but we allow other values
TailIterator TailIterator iterates over a base sequence starting at an element other than the first.
Token This class holds static constants and methods defining the lexical tokens used in XPath and XQuery, and associated keywords.
Tokenizer Tokenizer for expressions and inputs.
TreatExpression Treat Expression: implements "treat as data-type ( expression )".
TypeChecker This class provides Saxon's type checking capability.
UnaryExpression Unary Expression: an expression taking a single operand expression
UnionEnumeration An enumeration representing a nodeset that is a union of two other NodeSets.
UntypedAtomicConverter An UntypedAtomicConverter is an expression that converts any untypedAtomic items in a sequence to a specified type
UserFunctionCall This class represents a call to a user-defined function in the stylesheet or query.
ValueComparison ValueComparison: a boolean expression that compares two atomic values for equals, not-equals, greater-than or less-than.
ValueTailIterator ValueTailIterator iterates over a base sequence starting at an element other than the first.
VariableReference Variable reference: a reference to a variable.
VennExpression An expression representing a nodeset that is a union, difference, or intersection of two other NodeSets
XPathContextMajor This class represents a "major context" in which an XPath expression is evaluated: a "major context" object allows all aspects of the dynamic context to change, whereas a "minor context" only allows changes to the focus and the destination for push output.
XPathContextMinor This class represents a minor change in the dynamic context in which an XPath expression is evaluated: a "major context" object allows all aspects of the dynamic context to change, whereas a "minor context" only allows changes to the focus and the destination for push output.
 

Package net.sf.saxon.expr Description

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

The principal classes are:

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

ExpressionParser:
This class does the work of parsing both Expressions and Patterns. Applications should not call it directly. It uses the class Tokenizer for lexical analysis.

StaticContext:
This interface defines the information available at the time an expression is being parsed. This includes the names of variables, the bindings of namespace prefixes, the functions that are available, the names of collating sequences, and so on. When an XPath expression appears in a stylesheet, the class net.sf.saxon.style.ExpressionContext provides the StaticContext. For a free-standing XPath expression, the class net.sf.saxon.xpath.StandaloneContext is available, though a user-written class that implements StaticContext can also be used.

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

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

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


Michael H. Kay
Saxonica Limited
9 February 2005



Copyright (c) Saxonica Limited. All rights reserved.