The compilation is normally run from the command line, using the command:
java com.saxonica.CompileQuery [options] filename...
where filename is a list of XQuery source files to be compiled. It is also possible to
use wildcards, for example *.xq
to compile all the queries in a directory.
The options are as follows (note that these have not been converted to use the -key:value style used in other Saxon commands):
Option |
Meaning |
-package package-name |
Name of the Java package to use for the generated class(es). By default, the class(es) will not be in any package. |
-class class-name |
The name of the class to be generated, excluding any package name. Use only when compiling a single query. By default, a class name is constructed from the last part of the input filename, using an algorithm that strips punctuation and adds capitalization according to Java conventions. |
-jdir directory |
Directory to hold the generated Java source code. If the source code is generated in a package, then subdirectories will be created as necessary to represent the package structure. |
-e |
Explain: show the structure of the optimized query |
-servlet |
Generate the Java code in the form of a servlet |
-superclass |
Full name of the class to act as the superclass of the
generated class. Only needed if you want to customize the behavior.
Typically a user-defined subclass of |
-t |
Display progress information |
-sa |
Query is schema-aware |
-untyped |
Convert parameters to their required type. If set, this option causes the generated code to accept untypedAtomic values for external variables, and convert them to their declared type. This option is especially useful if the generated query is to be run from the command line, as all parameters supplied on the command line are treated as untypedAtomic values. |
The Java code is generated in the requested file, and it must then be compiled using the Java compiler
in the normal way. The classes referenced by the generated code are all in saxon9sa.jar
,
which must be on the compiler classpath.