Interface Compiler

All Known Implementing Classes:
TreeCompiler

public interface Compiler
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});