The XQuery language.
DEFAULT_ELEMENT_PREFIX
public static final String DEFAULT_ELEMENT_PREFIX
Pseudo-namespace "prefix" for the default element namespace.
DEFAULT_FUNCTION_PREFIX
public static final String DEFAULT_FUNCTION_PREFIX
Pseudo-namespace "prefix" for the default function namespace.
KAWA_FUNCTION_NAMESPACE
public static final String KAWA_FUNCTION_NAMESPACE
LOCAL_NAMESPACE
public static final String LOCAL_NAMESPACE
PARSE_WITH_FOCUS
public static final int PARSE_WITH_FOCUS
Special parser flag used by evalToFocusProc
.
QEXO_FUNCTION_NAMESPACE
public static final String QEXO_FUNCTION_NAMESPACE
SCHEMA_NAMESPACE
public static final String SCHEMA_NAMESPACE
XQUERY_FUNCTION_NAMESPACE
public static final String XQUERY_FUNCTION_NAMESPACE
defaultFunctionNamespacePath
public static final Namespace[] defaultFunctionNamespacePath
extensionsEnvEnv
public static Environment extensionsEnvEnv
Environment of pre-defined non-standard Qexo/Kawa functions.
kawaFunctionNamespace
public static final Namespace kawaFunctionNamespace
qexoFunctionNamespace
public static final Namespace qexoFunctionNamespace
writeFormat
public static final XMLFormat writeFormat
xqEnvironment
public static final Environment xqEnvironment
xqueryFunctionNamespace
public static final Namespace xqueryFunctionNamespace
applyWithFocus
public Object applyWithFocus(Procedure proc,
Object values)
throws Throwable
Call a procedure with each item in a sequence as the context item.
proc
- a 3-operand Procedure
as returned by
evalToFocusProc
values
- a sequence. The proc
is called once for each
item, with the item as the first argument, a 1-based index as the
second argument, and the sequence size as the third argument.
- the result of applying
proc
applyWithFocus
public void applyWithFocus(Procedure proc,
Object values,
Consumer out)
throws Throwable
Call a procedure with each item in a sequence as the context item.
proc
- a 3-operand Procedure
as returned by
evalToFocusProc
values
- a sequence. The proc
is called once for each
item, with the item as the first argument, a 1-based index as the
second argument, and the sequence size as the third argument.out
- where to send the result of proc
applyWithFocus
public Object applyWithFocus(Procedure proc,
Object item,
int position,
int size)
throws Throwable
Call a procedure with a given focus (context).
proc
- a 3-operand Procedure
as returned by
evalToFocusProc
item
- the context item, passed as the first argument to proc
position
- the context position, passed as the second argumentsize
- the context size, passed as the second argument
- the result of applying
proc
applyWithFocus
public void applyWithFocus(Procedure proc,
Object item,
int position,
int size,
Consumer out)
throws Throwable
Call a procedure with a given focus (context).
proc
- a 3-operand Procedure
as returned by
evalToFocusProc
item
- the context item, passed as the first argument to proc
position
- the context position, passed as the second argumentsize
- the context size, passed as the second argumentout
- where to send the result of proc
applyWithFocus$X
public void applyWithFocus$X(Procedure proc,
Object values,
CallContext ctx)
throws Throwable
Call a procedure with each item in a sequence as the context item.
proc
- a 3-operand Procedure
as returned by
evalToFocusProc
values
- a sequence. The proc
is called once for each
item, with the item as the first argument, a 1-based index as the
second argument, and the sequence size as the third argument.ctx
- the CallContext
. The $X
in the
method name tells Kawa that this argument is implicit when invoked
from XQuery.
asChar
public static char asChar(Object x)
asNumber
public static Numeric asNumber(Object arg)
define
public void define(String name,
Object value)
Enter a value into the current environment.
- define in interface Language
define_method
protected void define_method(String name,
String cname,
String mname)
evalToFocusProc
public Procedure evalToFocusProc(Reader in,
SourceMessages messages)
throws Throwable
Parse an XQuery expression from a Reader
that is the body of a procedure.
Helper method used by evalWithFocus
methods.
in
- where we read the expression frommessages
- where to write syntax errors
- a 3-operand Procedure whose arguments become
the context item, position, and size.
evalToFocusProc
public Procedure evalToFocusProc(String expr)
throws Throwable
Parse an XQuery expression that is the body of a procedure.
Helper method used by evalWithFocus
methods.
expr
- an XQuery expression (query) to evaluate
- a 3-operand Procedure whose arguments become
the context item, position, and size.
evalWithFocus
public void evalWithFocus(Reader in,
SourceMessages messages,
Object values,
Consumer out)
throws Throwable
Evaluate an expression with each item in a sequence as the context item.
in
- where we read the expression frommessages
- where to write syntax errorsvalues
- becomes the context sequence while
evaluating expr
.out
- where to send the result of the expression
evalWithFocus
public void evalWithFocus(Reader in,
SourceMessages messages,
Object item,
int position,
int size,
Consumer out)
throws Throwable
Evaluate an expression with a given focus (context).
in
- where we read the expression frommessages
- where to write syntax errorsitem
- becomes the context item while evaluating the expressionposition
- becomes the context positionsize
- becomes the context sizeout
- where to send the result of the expression
evalWithFocus
public Object evalWithFocus(String expr,
Object values)
throws Throwable
Evaluate an expression with each item in a sequence as the context item.
expr
- an XQuery expression (query) to evaluatevalues
- becomes the context sequence while
evaluating the expression
- the result of evaluating the expression
evalWithFocus
public Object evalWithFocus(String expr,
Object item,
int position,
int size)
throws Throwable
Evaluate an expression with a given focus (context).
expr
- an XQuery expression (query) to evaluateitem
- becomes the context item while evaluating expr
.position
- becomes the context positionsize
- becomes the context size
- the result of evaluating
expr
eval_with_focus$X
public void eval_with_focus$X(String expr,
Object values,
CallContext ctx)
throws Throwable
Evaluate an expression with a given focus (context).
Similar to evalWithFocus(String, Object, Consumer)
.
The "$X" in the method name tells the Kawa compiler that the CallContext
argument is implicit, so it can be invoked from XQuery code thus:
XQuery:eval-with-focus($xquery, "expr", $sequence)
eval_with_focus$X
public void eval_with_focus$X(String expr,
Object item,
int position,
int size,
CallContext ctx)
throws Throwable
Evaluate an expression with a given focus (context).
Similar to evalWithFocus(String, Object, int, int, Consumer)
.
The "$X" in the method name tells the Kawa compiler that the CallContext
argument is implicit, so it can be invoked from XQuery code thus:
XQuery:eval-with-focus($xquery, "expr", $item, $pos, $size)
getExternal
public static Object getExternal(SName name,
Object type)
getInstance
public static XQuery getInstance()
getNamespaceOf
public int getNamespaceOf(Declaration decl)
Return the namespace (e.g value or function) of a Declaration.
Return a bitmask of all the namespces "covered" by the Declaration.
- getNamespaceOf in interface Language
getOutputConsumer
public Consumer getOutputConsumer(java.io.Writer out)
hasSeparateFunctionNamespace
public boolean hasSeparateFunctionNamespace()
True if functions are in a separate anme space from variable.
Is true for e.g. Common Lisp, Emacs Lisp; false for Scheme.
- hasSeparateFunctionNamespace in interface Language
isTrue
public boolean isTrue(Object value)
Test if a value is considered "true" in this language.
- isTrue in interface Language
mangle
public static String mangle(String name)
registerEnvironment
public static void registerEnvironment()
The compiler insert calls to this method for applications and applets.