Package net.sf.saxon.expr
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.
-
Interface Summary Interface Description 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.Callable A generic interface for calling expressions by supplying the values of their subexpressionsCallableDelegate.Lambda ComparisonExpression Interface implemented by expressions that perform a comparisonComponentInvocation Represents an expression or instruction such as call-template, or a user function call, or a global variable reference, that needs to be bound to a target component, and can potentially be re-bound when the containing component is copied into another package.ContextMappingFunction ContextMappingFunction is an interface that must be satisfied by an object passed to a ContextMappingIterator.ContextOriginator Represents a construct that is responsible for originating a new context; used in analysing the stack of context objects for diagnosticsContextSwitchingExpression Interface implemented by expressions that switch the context, for example A/B or A[B]ExportAgent An export agent performs the job of exporting an expression to a SEF file.ExpressionOwner Abstraction representing any class that can act as the container for an expression: either an Operand of a parent expression, or a top-level construct such as a function or template or XQuery expressionItemFilter.Lambda ItemMapper.Lambda ItemMappingFunction ItemMappingFunction is an interface that must be satisfied by an object passed to a ItemMappingIterator.LambdaCallable A generic interface for calling expressions by supplying the values of their subexpressionsLastPositionFinder A LastPositionFinder is an interface implemented by any SequenceIterator that is able to return the position of the last item in the sequence.LocalBinding Binding for local variables and parameters: anything that is allocated a slot on the XPathContext stack frame.Locatable Represents a construct that has a meaningful location for use in diagnosticsMappingFunction 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 valuePendingUpdateList A PendingUpdateList is created by updating expressions in XQuery Update.SequenceMapper.Lambda StaticContext A StaticContext contains the information needed while an expression or pattern is being parsed.TailCallLoop.TailCallInfo UserFunctionResolvable A reference to a function; typically a forwards reference to a user-defined function in XQuery that has not yet been compiled.XPathContext This class represents a context in which an XPath expression is evaluated. -
Class Summary Class Description 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.AndExpression ArithmeticExpression Arithmetic Expression: an expression using one of the operators plus, minus, multiply, div, idiv, mod.AscendingRangeIterator An Iterator that produces numeric values in a monotonic sequence, ascending or descending.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 (or other supplied conversion) on each member of a supplied sequenceAtomicSequenceConverter.AtomicSequenceMappingFunction Mapping function wrapped around a converterAtomicSequenceConverter.ToStringMappingFunction Mapping function that converts every item in a sequence to a stringAtomizer An Atomizer is an expression corresponding essentially to the fn:data() function: it maps a sequence by replacing nodes with their typed valuesAttributeGetter An AttributeGetter is an expression that returns the value of a specific attribute of the context item, provided that it is an untyped element node.AxisAtomizingIterator This iterator returns a sequence of atomic values, the result of atomizing the sequence of nodes returned by an underlying SequenceIterator.AxisExpression An AxisExpression is always obtained by simplifying a PathExpression.BigRangeIterator An Iterator that produces numeric values in a monotonic ascending or descending sequence, where the integers may exceed the range of a LongBinaryExpression Binary Expression: a numeric or boolean expression consisting of the two operands and an operatorBooleanExpression 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 AnyAtomicTypeCalculator.AnyIdivAny Arithmetic: anyAtomicType idiv AnyAtomicTypeCalculator.AnyMinusAny Arithmetic: anyAtomicType - AnyAtomicTypeCalculator.AnyModAny Arithmetic: anyAtomicType mod AnyAtomicTypeCalculator.AnyPlusAny Arithmetic: anyAtomicType + AnyAtomicTypeCalculator.AnyTimesAny Arithmetic: anyAtomicType * AnyAtomicTypeCalculator.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 integerCalculator.IntegerIdivInteger Arithmetic: integer idiv integerCalculator.IntegerMinusInteger Arithmetic: integer - integerCalculator.IntegerModInteger Arithmetic: integer mod integerCalculator.IntegerPlusInteger Arithmetic: integer + integerCalculator.IntegerTimesInteger Arithmetic: integer * integerCallableDelegate An implementation ofCallable
that allows the logic to be supplied as a lambda expression.CardinalityChecker A CardinalityChecker implements the cardinality checking of "treat as": that is, it returns the supplied sequence, checking that its cardinality is correctCardinalityCheckingIterator 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 logicCompareToConstant This class implements a comparison of a computed value to a literal constant using one of the operators eq, ne, lt, gt, le, ge.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.CompareToStringConstant This class implements a comparison of a computed value to a string constant using one of the operators eq, ne, lt, gt, le, ge.Component Represents a component as defined in the XSLT 3.0 specification: for example a function, a named template, an attribute set, a global variable.Component.M ComponentBinding A ComponentBinding is a reference from one component to another; for example a variable reference or function call.ConsumingOperand This expression is used as a proxy for the consuming operand of an expression such as an arithmetic expression for which there is no explicit streaming support.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.DescendingRangeIterator Iterator that produces numeric values in a monotonic sequence, ascending or descending.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 part of the processing in "constructing simple content": it takes an input sequence and eliminates empty text nodes into one.EquivalenceComparer A comparer that compares atomic values for equality, with the properties: - non-comparable types compare false - NaN compares equal to NaNEquivalenceComparison Class to handle equivalence comparisons of singletons.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.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 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 valueFirstItemExpression A FirstItemExpression returns the first item in the sequence returned by a given base expressionForExpression A ForExpression maps an expression over a sequence.ForExpression.MappingAction The MappingAction represents the action to be taken for each item in the source sequence.ForMemberExpression A ForMemberExpression maps an expression over the members of an array.FunctionCall Abstract superclass for calls to system-defined and user-defined functionsGeneralComparison GeneralComparison: 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.GlobalVariableReference A reference to a global variableHomogeneityChecker 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 orderingInstanceOfExpression InstanceOf Expression: implements "Expr instance of data-type"IntegerRangeTest An IntegerRangeTest is an expression of the form E = N to M where 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 typeItemCheckingIterator ItemCheckingIterator applies a supplied function to each item in a sequence.ItemFilter ItemMapper is an implementation ofItemMappingFunction
that wraps a predicate function typically supplied as a lambda expression: unlike a standard Predicate, however, the test is allowed to throw anXPathException
.ItemMapper ItemMapper is an implementation ofItemMappingFunction
that wraps a function typically supplied as a lambda expression.ItemMappingIterator ItemMappingIterator applies a mapping function to each item in a sequence.ItemTypeCheckingFunction A mapping function for use in conjunction with anItemMappingIterator
that checks that all the items in a sequence are instances of a given item typeJPConverter This class together with its embedded subclasses handles conversion from Java values to XPath values.JPConverter.ExternalObjectWrapper 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.FromInstant JPConverter.FromInt JPConverter.FromIntArray JPConverter.FromLocalDate JPConverter.FromLocalDateTime JPConverter.FromLong JPConverter.FromLongArray JPConverter.FromObject JPConverter.FromObjectArray JPConverter.FromOffsetDateTime JPConverter.FromQName JPConverter.FromSequence JPConverter.FromSequenceIterator JPConverter.FromShort JPConverter.FromShortArray JPConverter.FromSource JPConverter.FromString JPConverter.FromURI JPConverter.FromXdmValue JPConverter.FromZonedDateTime JPConverter.VoidConverter LastItemExpression A LastItemExpression returns the last item in the sequence returned by a given base expression.LetExpression A LetExpression represents the XQuery construct let $x := expr return expr.ListCastableFunction A function item representing a castability test for a list typeListConstructorFunction A function item representing a constructor function for a list typeLiteral A Literal is an expression whose value is constant: it is a class that implements theExpression
interface as a wrapper around aGroundedValue
.LocalVariableReference Variable reference: a reference to a local variable.LookupAllExpression A lookup expression is an expression of the form A?*, where A must be a map or an arrayLookupExpression A lookup expression is an expression of the form A?B.MappingIterator MappingIterator merges a sequence of sequences into a single flat sequence.NegateExpression Negate Expression: implements the unary minus operator.NumberSequenceFormatter This expression performs the formatting part of the logic of the xsl:number instruction It takes as input a sequence of integers, which may either be supplied directly as the value attribute of xsl:number, or may be computed by counting nodes.Operand Information about a sub-expression and its relationship to the parent expressionOperandRole Defines the role of a child expression relative to its parent expression.OrExpression PackageData Information about a unit of compilation: in XSLT, a package; in XQuery, a module.PatternMatchExpression An expression corresponding to the XSLT 4.0 xsl:match instruction: returns true if every item in a supplied sequence matches a supplied patternPJConverter This class together with its embedded subclasses handles conversion from XPath values to Java valuesPJConverter.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.CalendarValueToInstant PJConverter.CalendarValueToLocalDateTime PJConverter.CalendarValueToOffsetDateTime PJConverter.CalendarValueToZonedDateTime PJConverter.ConditionalUnwrapExternalObject PJConverter.DateValueToLocalDate 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.StringItemToChar PJConverter.StringItemToString PJConverter.ToArray Converter for use when the target class is an arrayPJConverter.ToCollection Converter for use when the target class is a collection class.PJConverter.ToNull PJConverter.ToOne Converter for use when the target class isOne
, which constrains the value to be a singletonPJConverter.ToOneOrMore Converter for use when the target class isOneOrMore
, which constrains the value to be a non-empty sequencePJConverter.ToSequenceExtent PJConverter.ToSequenceIterator PJConverter.ToZeroOrMore Converter for use when the target class isZeroOrMore
, which allows any sequence but is a generic (parameterized) class so there is compile-time information about the type of itemsPJConverter.ToZeroOrOne Converter for use when the target class isZeroOrOne
, which constrains the value to be a singleton or an empty sequencePJConverter.UnwrapExternalObject PseudoExpression A pseudo-expression is an object that can appear as a node on the expression tree, but which cannot actually be evaluated in its own right.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").RootExpression An expression whose value is always a set of nodes containing a single node, the document root.SequenceMapper SequenceMapper is an implementation ofMappingFunction
that wraps a function typically supplied as a lambda expression.SimpleExpression An abstract implementation of Expression designed to make it easy to implement new expressions, in particular, expressions to support extension instructions.SimpleStepExpression A 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 sequenceSingletonAtomizer 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.StaticFunctionCall A call to a function that is known statically.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 caseSubscriptExpression A SubscriptExpression represents a FilterExpression of the form EXPR[n] where n is known to be singleton numeric and to be independent of the focus; it does not need to be constantSubsequenceIterator A SubsequenceIterator selects a subsequence of a sequenceSuppliedParameterReference Supplied parameter reference: this is an internal expression used to refer to the value of the n'th parameter supplied on a template call or a call to an inline function.SystemFunctionCall A call to a system-defined function (specifically, a function implemented as an instance ofSystemFunction
)SystemFunctionCall.Optimized Subclass representing a system function call that has been optimized; this overrides the optimize() method to do nothing, thus ensuring that optimization converges.TailCallLoop A TailCallLoop wraps the body of a function that contains tail-recursive function calls.TailCallLoop.TailCallComponent TailCallLoop.TailCallFunction TailExpression A TailExpression represents a FilterExpression of the formEXPR[position() > n]
Here n is usually 2, but we allow other valuesTailIterator TailIterator iterates over a base sequence starting at an element other than the first.TreatExpression Treat Expression: implements "treat as data-type ( expression )".TryCatch This class implements a try/catch expression.TryCatch.CatchClause UnaryExpression Unary Expression: an expression taking a single operand expressionUnionCastableFunction Function to test castability to a union typeUnionConstructorFunction Function to perform a cast to a union typeUnionEnumeration An enumeration representing a nodeset that is a union of two other NodeSets.UnionIterator A multi-way union delivering the sorted results obtained from a number of sorted input iteratorsUntypedSequenceConverter An UntypedSequenceConverter is an expression that performs a cast on each member of a supplied sequence that is an untypedAtomic value, while leaving other items unchangedUntypedSequenceConverter.UntypedConverter A Converter that converts untyped atomic values to the required type, while leaving other values unchangedUserFunctionCall 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 NodeSetsXPathContextMajor 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.XPathContextMajor.ThreadManager The ThreadManager is used to manage asynchronous execution of xsl:result-document instructions in Saxon-EE.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. -
Enum Summary Enum Description GeneralComparison.ComparisonCardinality OperandUsage The usage of an operand defines how the containing expression makes use of the value of the operand, as defined in the XSLT 3.0 specification.