public class CompileXPath extends SystemFunction
The compile-XPath() extension function compiles an XPath expression to a SEF representation. It was originally defined for Saxon-JS to allow free-standing compilation and execution of dynamic XPath expressions in the browser; this is a back-port to Saxon-Java so that the same code can be executed in either environment, which facilitates testing.
|Constructor and Description|
|Modifier and Type||Method and Description|
Evaluate this function call at run-time
Upgraded from ExpressionTool.make() to permit 'in-catch' conversion of error variables to calls on saxon:dynamic-error-info()
dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, exportAttributes, fixArguments, getArity, getCardinality, getCompilerName, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, getStreamerName, getUniStringArg, hashCode, importAttributes, isSequenceVariadic, isTrustedResultType, makeCall, makeFunction, makeFunctionCall, makeOptimizedFunctionCall, resultIfEmpty, setArity, setDetails, setRetainedStaticContext, supplyTypeInformation, toShortString, toString, typeCheckCaller
atomize, deepEquals, effectiveBooleanValue, getAnnotations, getUnicodeStringValue, isArray, isMap, makeNewContext, simplify, typeCheck
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getLength, getStringValue, head, isStreamed, itemAt, iterate, reduce, subsequence
asIterable, concatenate, containsNode, materialize
public MapItem call(XPathContext context, Sequence arguments) throws XPathException
context- The XPath dynamic evaluation context
arguments- The values of the arguments to the function call. Each argument value (which is in general a sequence) is supplied in the form of an iterator over the items in the sequence. If required, the supplied sequence can be materialized by calling, for example,
new SequenceExtent(arguments[i]). If the argument is always a singleton, then the single item may be obtained by calling
arguments[i].next(). The implementation is not obliged to read all the items in each
SequenceIteratorif they are not required to compute the result; but if any SequenceIterator is not read to completion, it is good practice to call its close() method.
SingletonIterator. If the result is an empty sequence, the method should return
XPathException- if a dynamic error occurs during evaluation of the function. The Saxon run-time code will add information about the error location.
public static Expression make(java.lang.String expression, StaticContext env, int start, int terminator, CodeInjector codeInjector, boolean inCatch) throws XPathException
Parse an XPath expression. This performs the basic analysis of the expression against the grammar, it binds variable references and function calls to variable definitions and function definitions, and it performs context-independent expression rewriting for optimization purposes.
expression- The expression (as a character string)
env- An object giving information about the compile-time context of the expression
start- position of the first significant character in the expression
terminator- The token that marks the end of this expression; typically Token.EOF, but may for example be a right curly brace
codeInjector- true allows injection of tracing, debugging, or performance monitoring code; null if not required
inCatch- The Xpath is considered to be in the context of an xsl:catch
XPathException- if the expression contains a static error
Copyright (c) 2004-2021 Saxonica Limited. All rights reserved.