The Compiler APIs are completely agnostic to the actual types of objects
produced and consumed by the APIs. Arguments and return values are
declared as java.lang.Object.
Since objects returned by Compiler methods are passed as arguments to other
Compiler methods, the descriptions of these methods use virtual types. There
are four virtual object types: EXPRESSION, QNAME, STEP and NODE_TEST.
The following example illustrates this notion. This sequence compiles
the xpath "foo[round(1 div 2)]/text()":
Object qname1 = compiler.qname(null, "foo")
Object expr1 = compiler.number("1");
Object expr2 = compiler.number("2");
Object expr3 = compiler.div(expr1, expr2);
Object expr4 = compiler.
coreFunction(Compiler.FUNCTION_ROUND, new Object[]{expr3});
Object test1 = compiler.nodeNameTest(qname1);
Object step1 = compiler.
step(Compiler.AXIS_CHILD, test1, new Object[]{expr4});
Object test2 = compiler.nodeTypeTest(Compiler.NODE_TYPE_TEXT);
Object step2 = compiler.nodeTypeTest(Compiler.AXIS_CHILD, test2, null);
Object expr5 = compiler.locationPath(false, new Object[]{step1, step2});
AXIS_ANCESTOR
public static final int AXIS_ANCESTOR
AXIS_ANCESTOR_OR_SELF
public static final int AXIS_ANCESTOR_OR_SELF
AXIS_ATTRIBUTE
public static final int AXIS_ATTRIBUTE
AXIS_CHILD
public static final int AXIS_CHILD
AXIS_DESCENDANT
public static final int AXIS_DESCENDANT
AXIS_DESCENDANT_OR_SELF
public static final int AXIS_DESCENDANT_OR_SELF
AXIS_FOLLOWING
public static final int AXIS_FOLLOWING
AXIS_FOLLOWING_SIBLING
public static final int AXIS_FOLLOWING_SIBLING
AXIS_NAMESPACE
public static final int AXIS_NAMESPACE
AXIS_PARENT
public static final int AXIS_PARENT
AXIS_PRECEDING
public static final int AXIS_PRECEDING
AXIS_PRECEDING_SIBLING
public static final int AXIS_PRECEDING_SIBLING
AXIS_SELF
public static final int AXIS_SELF
FUNCTION_BOOLEAN
public static final int FUNCTION_BOOLEAN
FUNCTION_CEILING
public static final int FUNCTION_CEILING
FUNCTION_CONCAT
public static final int FUNCTION_CONCAT
FUNCTION_CONTAINS
public static final int FUNCTION_CONTAINS
FUNCTION_COUNT
public static final int FUNCTION_COUNT
FUNCTION_FALSE
public static final int FUNCTION_FALSE
FUNCTION_FLOOR
public static final int FUNCTION_FLOOR
FUNCTION_FORMAT_NUMBER
public static final int FUNCTION_FORMAT_NUMBER
FUNCTION_ID
public static final int FUNCTION_ID
FUNCTION_KEY
public static final int FUNCTION_KEY
FUNCTION_LANG
public static final int FUNCTION_LANG
FUNCTION_LAST
public static final int FUNCTION_LAST
FUNCTION_LOCAL_NAME
public static final int FUNCTION_LOCAL_NAME
FUNCTION_NAME
public static final int FUNCTION_NAME
FUNCTION_NAMESPACE_URI
public static final int FUNCTION_NAMESPACE_URI
FUNCTION_NORMALIZE_SPACE
public static final int FUNCTION_NORMALIZE_SPACE
FUNCTION_NOT
public static final int FUNCTION_NOT
FUNCTION_NULL
public static final int FUNCTION_NULL
FUNCTION_NUMBER
public static final int FUNCTION_NUMBER
FUNCTION_POSITION
public static final int FUNCTION_POSITION
FUNCTION_ROUND
public static final int FUNCTION_ROUND
FUNCTION_STARTS_WITH
public static final int FUNCTION_STARTS_WITH
FUNCTION_STRING
public static final int FUNCTION_STRING
FUNCTION_STRING_LENGTH
public static final int FUNCTION_STRING_LENGTH
FUNCTION_SUBSTRING
public static final int FUNCTION_SUBSTRING
FUNCTION_SUBSTRING_AFTER
public static final int FUNCTION_SUBSTRING_AFTER
FUNCTION_SUBSTRING_BEFORE
public static final int FUNCTION_SUBSTRING_BEFORE
FUNCTION_SUM
public static final int FUNCTION_SUM
FUNCTION_TRANSLATE
public static final int FUNCTION_TRANSLATE
FUNCTION_TRUE
public static final int FUNCTION_TRUE
NODE_TYPE_COMMENT
public static final int NODE_TYPE_COMMENT
NODE_TYPE_NODE
public static final int NODE_TYPE_NODE
NODE_TYPE_PI
public static final int NODE_TYPE_PI
NODE_TYPE_TEXT
public static final int NODE_TYPE_TEXT
and
public Object and(arguments[] )
Produces an EXPRESSION object representing logical conjunction of
all arguments
divide
public Object divide(Object left,
Object right)
Produces an EXPRESSION object representing left divided by
right
left
- is an EXPRESSION objectright
- is an EXPRESSION object
equal
public Object equal(Object left,
Object right)
Produces an EXPRESSION object representing the comparison:
left equals to right
left
- is an EXPRESSION objectright
- is an EXPRESSION object
expressionPath
public Object expressionPath(Object expression,
Object[] predicates,
Object[] steps)
Produces an EXPRESSION object representing a filter expression
expression
- is an EXPRESSION objectpredicates
- are EXPRESSION objectssteps
- are STEP objects
function
public Object function(Object name,
Object[] args)
Produces an EXPRESSION object representing the computation of
a library function with the supplied arguments.
name
- is a QNAME object (function name)args
- are EXPRESSION objects
function
public Object function(int code,
Object[] args)
Produces an EXPRESSION object representing the computation of
a core function with the supplied arguments.
code
- is one of FUNCTION_... constantsargs
- are EXPRESSION objects
greaterThan
public Object greaterThan(Object left,
Object right)
Produces an EXPRESSION object representing the comparison:
left greater than right
left
- is an EXPRESSION objectright
- is an EXPRESSION object
greaterThanOrEqual
public Object greaterThanOrEqual(Object left,
Object right)
Produces an EXPRESSION object representing the comparison:
left greater than or equal to right
left
- is an EXPRESSION objectright
- is an EXPRESSION object
lessThan
public Object lessThan(Object left,
Object right)
Produces an EXPRESSION object representing the comparison:
left less than right
left
- is an EXPRESSION objectright
- is an EXPRESSION object
lessThanOrEqual
public Object lessThanOrEqual(Object left,
Object right)
Produces an EXPRESSION object representing the comparison:
left less than or equal to right
left
- is an EXPRESSION objectright
- is an EXPRESSION object
literal
public Object literal(String value)
Produces an EXPRESSION object that represents a string constant.
locationPath
public Object locationPath(boolean absolute,
Object[] steps)
Produces an EXPRESSION object representing a location path
absolute
- indicates whether the path is absolutesteps
- are STEP objects
minus
public Object minus(Object argument)
Produces an EXPRESSION object representing unary negation of the argument
argument
- is an EXPRESSION object
minus
public Object minus(Object left,
Object right)
Produces an EXPRESSION object representing left minus right
left
- is an EXPRESSION objectright
- is an EXPRESSION object
mod
public Object mod(Object left,
Object right)
Produces an EXPRESSION object representing left modulo
right
left
- is an EXPRESSION objectright
- is an EXPRESSION object
multiply
public Object multiply(Object left,
Object right)
Produces an EXPRESSION object representing left multiplied by
right
left
- is an EXPRESSION objectright
- is an EXPRESSION object
nodeNameTest
public Object nodeNameTest(Object qname)
Produces a NODE_TEST object that represents a node name test.
qname
- is a QNAME object
nodeTypeTest
public Object nodeTypeTest(int nodeType)
Produces a NODE_TEST object that represents a node type test.
notEqual
public Object notEqual(Object left,
Object right)
Produces an EXPRESSION object representing the comparison:
left is not equal to right
left
- is an EXPRESSION objectright
- is an EXPRESSION object
number
public Object number(String value)
Produces an EXPRESSION object that represents a numeric constant.
or
public Object or(arguments[] )
Produces an EXPRESSION object representing logical disjunction of
all arguments
processingInstructionTest
public Object processingInstructionTest(String instruction)
Produces a NODE_TEST object that represents a processing instruction
test.
qname
public Object qname(String prefix,
String name)
Produces an QNAME that represents a name with an optional prefix.
step
public Object step(int axis,
Object nodeTest,
Object[] predicates)
Produces a STEP object that represents a node test.
axis
- is one of the AXIS_... constantsnodeTest
- is a NODE_TEST objectpredicates
- are EXPRESSION objects
sum
public Object sum(Object[] arguments)
Produces an EXPRESSION object representing the sum of all argumens
arguments
- are EXPRESSION objects
union
public Object union(Object[] arguments)
Produces an EXPRESSION object representing union of all node sets
arguments
- are EXPRESSION objects
variableReference
public Object variableReference(Object qName)
Produces an EXPRESSION object representing variable reference