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.
CallableExpression A generic interface for calling expressions by supplying the values of their subexpressions
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<T extends Item> 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]
ItemMappingFunction<F extends Item,T extends Item> ItemMappingFunction is an interface that must be satisfied by an object passed to a ItemMappingIterator.
LastPositionFinder<T extends Item> A LastPositionFinder is an interface implemented by any SequenceIterator that is able to return the position of the last item in the sequence.
MappingFunction<F extends Item,T extends Item> 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.
StatefulMappingFunction<F extends Item,T extends Item> 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
AdjacentTextNodeMerger This class performs the first phase of processing in "constructing simple content": it takes an input sequence, eliminates empty text nodes, and combines adjacent text nodes into one.
AnalyzeMappingFunction Mapping function that maps the sequence of matching/non-matching strings to the sequence delivered by applying the matching-substring and non-matching-substring expressions respectively to each such string
AndExpression  
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.
AtomicSequenceConverter An AtomicSequenceConverter is an expression that performs a cast on each member of a supplied sequence
AtomicSequenceConverter.AtomicSequenceMappingFunction Mapping function wrapped around a converter
AtomicSequenceConverter.ToStringMappingFunction Mapping function that converts every item in a sequence to a string
AtomicSequenceConverter.UntypedConverter  
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.
Calculator.AnyDivAny Arithmetic: anyAtomicType div AnyAtomicType
Calculator.AnyIdivAny Arithmetic: anyAtomicType idiv AnyAtomicType
Calculator.AnyMinusAny Arithmetic: anyAtomicType - AnyAtomicType
Calculator.AnyModAny Arithmetic: anyAtomicType mod AnyAtomicType
Calculator.AnyPlusAny Arithmetic: anyAtomicType + AnyAtomicType
Calculator.AnyTimesAny Arithmetic: anyAtomicType * AnyAtomicType
Calculator.DecimalDivDecimal Arithmetic: decimal div decimal (including types that promote to decimal, that is, integer)
Calculator.DecimalIdivDecimal Arithmetic: decimal idiv decimal (including types that promote to decimal, that is, integer)
Calculator.DecimalMinusDecimal Arithmetic: decimal - decimal (including types that promote to decimal, that is, integer)
Calculator.DecimalModDecimal Arithmetic: decimal mod decimal (including types that promote to decimal, that is, integer)
Calculator.DecimalPlusDecimal Arithmetic: decimal + decimal (including types that promote to decimal, that is, integer)
Calculator.DecimalTimesDecimal Arithmetic: decimal * decimal (including types that promote to decimal, that is, integer)
Calculator.DoubleDivDouble Arithmetic: double div double (including types that promote to double)
Calculator.DoubleMinusDouble Arithmetic: double - double (including types that promote to double)
Calculator.DoubleModDouble Arithmetic: double mod double (including types that promote to double)
Calculator.DoublePlusDouble Arithmetic: double + double (including types that promote to double)
Calculator.DoubleTimesDouble Arithmetic: double * double (including types that promote to double)
Calculator.FloatDivFloat Arithmetic: float div float (including types that promote to float)
Calculator.FloatIdivFloat Arithmetic: float idiv float (including types that promote to float)
Calculator.FloatMinusFloat Arithmetic: float - float (including types that promote to float)
Calculator.FloatModFloat Arithmetic: float mod float (including types that promote to float)
Calculator.FloatPlusFloat Arithmetic: float + float (including types that promote to float)
Calculator.FloatTimesFloat Arithmetic: float * float (including types that promote to float)
Calculator.IntegerDivInteger Arithmetic: integer div integer
Calculator.IntegerIdivInteger Arithmetic: integer idiv integer
Calculator.IntegerMinusInteger Arithmetic: integer - integer
Calculator.IntegerModInteger Arithmetic: integer mod integer
Calculator.IntegerPlusInteger Arithmetic: integer + integer
Calculator.IntegerTimesInteger Arithmetic: integer * integer
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 )".
CastingExpression Casting Expression: abstract superclass for "cast as X" and "castable as X", which share a good deal of logic
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<T extends Item> 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.
EmptyTextNodeRemover This class performs the first phase of processing in "constructing simple content": it takes an input sequence, eliminates empty text nodes, and combines adjacent text nodes into one.
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.
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 CompiledFilterIterator 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.
GeneralComparison20 The class GeneralComparison20 specializes GeneralComparison for the case where the comparison is done with 2.0 semantics (i.e.
HomogeneityChecker This class is an expression that does a run-time check of the result of a "/" expression to ensure that (a) the results consists entirely of atomic values and function items, or entirely of nodes, and (b) if the results are nodes, then they are deduplicated and sorted into document order.
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<F extends Item,T extends Item> ItemMappingIterator applies a mapping function to each item in a sequence.
ItemTypeCheckingFunction<T extends Item> A mapping function for use in conjunction with an ItemMappingIterator that checks that all the items in a sequence are instances of a given item type
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.
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<F extends Item,T extends Item> MappingIterator merges a sequence of sequences into a single flat sequence.
MonoIterator<T> 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.
OrExpression  
PairIterator<T> An iterator over a pair of objects (typically sub-expressions of an expression)
ParentNodeExpression Class ParentNodeExpression represents the XPath expression ".." or "parent::node()"
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 ...".
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.
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.
SimpleStepExpression An SimpleStepExpression is a special case of a SlashExpression in which the start expression selects a single item (or nothing), and the step expression is a simple AxisExpression.
SingleItemFilter A SingleItemFilter is an expression that selects zero or one items from a supplied sequence
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.
SingletonIntersectExpression This expression is equivalent to (A intersect B) in the case where A has cardinality zero-or-one.
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<T extends Item> TailIterator iterates over a base sequence starting at an element other than the first.
TreatExpression Treat Expression: implements "treat as data-type ( expression )".
UnaryExpression Unary Expression: an expression taking a single operand expression
UnionEnumeration An enumeration representing a nodeset that is a union of two other NodeSets.
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<T extends Item> 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.
XPathContextMinor.LastValue Container for cached value of the last() function.
 

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) 2004-2011 Saxonica Limited. All rights reserved.