Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > XML applications > Use the XML API to perform operations > Precompile
Precompile using the command-line tools
We can use the CompileXSLT tool to precompile one or more stylesheets, use the CompileXPath tool to precompile one or more XPath expressions, and use the CompileXQuery tool to precompile one or more XQuery expressions.
See Precompile using ANT tasks for information about using the TaskCompileXPath, TaskCompileXQuery, and TaskCompileXSLT ANT tasks as alternatives to using the CompileXPath, CompileXQuery, and CompileXSLT commands.
Procedure
- Compile XSLT
- Location
- The product includes the following script that sets up the environment and invokes the tool.
- (Windows) WAS_HOME\bin\compileXSLT.bat
- (AIX) (Solaris) WAS_HOME/bin/compileXSLT.sh
- Syntax
- (Windows)
compileXSLT.bat -out output -dir directory -pkg package [-func name=funcName type=funcType argtype=argType...] ... -baseURI URI -imm int -v -h { stylesheet... | -i }(AIX) (Solaris)./compileXSLT.sh -out output -dir directory -pkg package [-func name=funcName type=funcType argtype=argType...] ... -baseURI URI -imm int -v -h { stylesheet... | -i }
- Parameters
- -out output
- Uses the name output as the base name for the generated classes
By default, the base name is XSLTModule.
This option is ignored if compiling multiple stylesheets.
- -dir directory
- Specifies a destination directory for the generated classes
The default is the current working directory.
- -pkg package
- Specifies a package name prefix for all generated classes
The default is the Java default package.
- -func name=funcName type=funcType argtype=argType
- Adds a function binding to the static context for a single item
This simply declares the function, and a method object for the function also must be bound to the dynamic context at execution time.
- funcName
- Name of the function (expressed localPart,namespaceURI)
- funcType
- Return type of the function (expressed localPart,namespaceURI)
- argType
- Types of the function arguments (expressed localPart,namespaceURI) and is optional
This option can be used multiple times.
If the value of any option contains a blank space, enclose it in quotation marks.
This option can be used multiple times.
For example:
-func name=getId,http://example.org type=integer,http://www.w3.org/2001/XMLSchema argtype=string,http://www.w3.org/2001/XMLSchema
- -baseURI URI
- Base URI of the containing element
- -imm int
- Sets the integer math mode, which is a constant representing the level of precision required and whether overflow detection is required when working with xs:integer values
Valid values include:
- 1
- Values need only support the minimum precision required for a minimally conforming processor (18 digits).
- 2
- Values should support an arbitrary number of digits of precision; no overflow should occur.
- 3
- Values need only support the minimum precision required for a minimally conforming processor (18 digits); but any overflow condition should be detected and error FOAR0002 should be raised.
- -i
- Forces the compiler to read the stylesheet from standard in
- -v
- Prints the version of the compiler
- -h
- Prints the usage statement
- stylesheet
- Full path to a file containing an XSL stylesheet to be compiled
The following is a basic example of compiling a stylesheet using the CompileXSLT tool:
- (Windows) compileXSLT.bat -pkg com.examples -dir C:\stylesheets\output C:\stylesheets\simple.xml
This compiles the C:\stylesheets\simple.xml stylesheet and places the resulting files in C:\stylesheets\output\com\examples.
- (AIX) (Solaris) ./compileXSLT.sh -pkg com.examples -dir /var/stylesheets/output /var/stylesheets/simple.xml
This compiles the /var/stylesheets/simple.xml stylesheet and places the resulting files in /var/stylesheets/output/com/examples.
- Compile an XPath expression
- Location
- The product includes the following script that sets up the environment and invokes the tool.
- (Windows) WAS_HOME\bin\compileXPath.bat
- (AIX) (Solaris) WAS_HOME/bin/compileXPath.sh
- Syntax
- (Windows)
compileXPath.bat -out output -dir directory -pkg package -cpm mode -ns prefix=URI -schema URI [-func name=funcName type=funcType argtype=argType...] ... [-var name=varName type=varType] ... -baseURI URI -dnet URI -dnf URI -imm int -v -h { xpathfile... | -i }(AIX) (Solaris)./compileXPath.sh -out output -dir directory -pkg package -cpm mode -ns prefix=URI -schema URI [-func name=funcName type=funcType argtype=argType...] ... [-var name=varName type=varType] ... -baseURI URI -dnet URI -dnf URI -imm int -v -h { xpathfile... | -i }
- Parameters
- -out output
- Uses the name output as the base name for the generated classes
By default, the base is XPathModule.
This option is ignored if compiling multiple expressions.
- -dir directory
- Specifies a destination directory for the generated executable
The default is the current working directory.
- -pkg package
- Specifies a package name prefix for all generated classes
The default is the Java default package.
- -cpm mode
- Specifies an alternate XPath compatibility mode.
For example, use 1.0 for compatibility with XPath v1.0.
- -ns prefix=URI
- Specifies a namespace for use during static processing
If the value of any option contains a blank space, enclose it in quotation marks.
This option can be used multiple times. In the case of multiple -ns arguments with the same prefix, the last one prevails.
- -schema URI
- Specifies any schema file used to populate the in-scope schema definitions
This option can be used multiple times.
- -func name=funcName type=funcType argtype=argType
- Adds a function binding to the static context for a single item
This simply declares the function, and a method object for the function also must be bound to the dynamic context at execution time.
- funcName
- Name of the function (expressed localPart,namespaceURI)
- funcType
- Return type of the function (expressed localPart,namespaceURI)
- argType
- Types of the function arguments (expressed localPart,namespaceURI) and is optional
This option can be used multiple times.
If the value of any option contains a blank space, enclose it in quotation marks.
This option can be used multiple times.
For example:
-func name=getId,http://example.org type=integer,http://www.w3.org/2001/XMLSchema argtype=string,http://www.w3.org/2001/XMLSchema
- -var name=varName type=varType
- Adds a variable binding to the static context for a single item
This simply declares the variable, and a value also must be bound to the XDynamicContext at execution time.
- varName
- Name of the variable (expressed localPart[, namespaceURI])
If the variable is in no namespace, the namespace URI should be omitted.
Localpart is a required value.
- varType
- Type of the variable (expressed localPart,namespaceURI)
If the value of any option contains a blank space, enclose it in quotation marks.
This option can be used multiple times.
For example:
-var name=la,"http://www.ibm.com/Los Angeles" type=boolean,http://www.w3.org/2001/XMLSchema
- -baseURI URI
- Base URI of the containing element
- -dnet URI
- Specifies a default namespace URI for element and type names
The namespace URI, if present, is used for any unprefixed QName appearing in a position where an element or type name is expected.
- -dnf URI
- Specifies a default namespace URI for function names
The namespace URI, if present, is used for any unprefixed QName appearing in a position where a function name is expected.
- -imm int
- Sets the integer math mode, which is a constant representing the level of precision required and whether overflow detection is required when working with xs:integer values
Valid values include:
- 1
- Values need only support the minimum precision required for a minimally conforming processor (18 digits).
- 2
- Values should support an arbitrary number of digits of precision; no overflow should occur.
- 3
- Values need only support the minimum precision required for a minimally conforming processor (18 digits); but any overflow condition should be detected and error FOAR0002 should be raised.
- -v
- Prints the version of the compiler
- -h
- Prints the usage statement
- xpathfile
- Full path to a file containing an XPath expression to be compiled
- -i
- Forces the compiler to read the XPath expression from standard in
The following is a basic example of compiling an XPath expression using the CompileXPath tool:
- (Windows) compileXPath.bat -pkg com.examples -dir C:\XPath\output C:\XPath\simpleXPath.txt
This compiles the XPath expression provided in C:\XPath\simpleXPath.txt and places the resulting files in C:\XPath\output\com\examples.
- (AIX) (Solaris) ./compileXPath.sh -pkg com.examples -dir /var/XPath/output /var/XPath/simpleXPath.txt
This compiles the XPath expression provided in /var/XPath/simpleXPath.txt and places the resulting files in /var/XPath/output/com/examples.
- Compile an XQuery expression
- Location
- The product includes the following script that sets up the environment and invokes the tool.
- (Windows) WAS_HOME\bin\compileXQuery.bat
- (AIX) (Solaris) WAS_HOME/bin/compileXQuery.sh
- Syntax
- (Windows)
compileXQuery.bat -out output -dir directory -pkg package [-func name=funcName type=funcType argtype=argType...] ... -baseURI URI -dnet URI -dnf URI -imm int -bsp int -csm int -cnmi int -cnmp int -eso int -ordm int -v -h { xqueryfile... | -i }(AIX) (Solaris)./compileXQuery.sh -out output -dir directory -pkg package [-func name=funcName type=funcType argtype=argType...] ... -baseURI URI -dnet URI -dnf URI -imm int -bsp int -csm int -cnmi int -cnmp int -eso int -ordm int -v -h { xqueryfile... | -i }
- Parameters
- -out output
- Uses the name output as the base name for the generated classes
By default, the base name is XQueryModule.
This option is ignored if compiling multiple expressions.
- -dir directory
- Specifies a destination directory for the generated classes
The default is the current working directory.
- -pkg package
- Specifies a package name prefix for all generated classes
The default is the Java default package.
- -func name=funcName type=funcType argtype=argType
- Adds a function binding to the static context for a single item
This simply declares the function, and a method object for the function also must be bound to the dynamic context at execution time.
- funcName
- Name of the function (expressed localPart,namespaceURI)
- funcType
- Return type of the function (expressed localPart,namespaceURI)
- argType
- Types of the function arguments (expressed localPart,namespaceURI) and is optional
This option can be used multiple times.
If the value of any option contains a blank space, enclose it in quotation marks.
This option can be used multiple times.
For example:
-func name=getId,http://example.org type=integer,http://www.w3.org/2001/XMLSchema argtype=string,http://www.w3.org/2001/XMLSchema
- -baseURI URI
- Base URI of the containing element
- -dnet URI
- Specifies a default namespace URI for element and type names
The namespace URI, if present, is used for any unprefixed QName appearing in a position where an element or type name is expected.
- -dnf URI
- Specifies a default namespace URI for function names
The namespace URI, if present, is used for any unprefixed QName appearing in a position where a function name is expected.
- -imm int
- Sets the integer math mode, which is a constant representing the level of precision required and whether overflow detection is required when working with xs:integer values
Valid values include:
- 1
- Values need only support the minimum precision required for a minimally conforming processor (18 digits).
- 2
- Values should support an arbitrary number of digits of precision; no overflow should occur.
- 3
- Values need only support the minimum precision required for a minimally conforming processor (18 digits); but any overflow condition should be detected and error FOAR0002 should be raised.
- -bsp int
- Boundary space policy
Valid values include:
- 1
- Preserve white spaces
- 2
- Strip white spaces
This is the default value.
- -csm int
- Construction mode
Valid values include:
- 1
- Preserve
The type of a constructed element node is xs:anyType, and all attribute and element nodes copied during node construction retain their original types.
This is the default value.
- 2
- Strip
The type of a constructed element node is xs:untyped, all element nodes copied during node construction receive the type xs:untyped, and all attribute nodes copied during node construction receive the type xs:untypedAtomic.
- -cnmi int
- Inherit part of the copy-namespaces
Valid values include:
- 1
- Inherit
Inherit mode should be used in namespace binding assignment when an existing element node is copied by an element constructor.
This is the default value.
- 2
- No inherit
No-inherit mode should be used in namespace binding assignment when an existing element node is copied by an element constructor.
- -cnmp int
- Preserve part of the copy-namespaces
Valid values include:
- 1
- Preserve
Preserve mode should be used in namespace binding assignment when an existing element node is copied by an element constructor.
This is the default value.
- 2
- No preserve
No-preserve mode should be used in namespace binding assignment when an existing element node is copied by an element constructor.
- -eso int
- Empty sequence order
Valid values include:
- 1
- Greatest
- 2
- Least
This is the default value.
- -ordm int
- Ordering mode
Valid values include:
- 1
- Ordered results are to be returned by certain path expressions, union, intersect, and except expressions, as well as FLWOR expressions that have no order by clause
This is the default value.
- 2
- Unordered results are to be returned by certain path expressions, union, intersect, and except expressions, as well as FLWOR expressions that have no order by clause
- -v
- Prints the version of the compiler
- -h
- Prints the usage statement
- xqueryfile
- Full path to a file containing an XQuery expression to be compiled
- -i
- Forces the compiler to read the stylesheet from standard in
The following is a basic example of compiling an XQuery expression using the CompileXQuery tool:
- (Windows) compileXQuery.bat -pkg com.examples -dir C:\XQuery\output C:\XQuery\simpleXQuery.txt
This compiles the XQuery expression provided in C:\XQuery\simpleXQuery.txt and places the resulting files in C:\XQuery\output\com\examples.
- (AIX) (Solaris) ./compileXQuery.sh -pkg com.examples -dir /var/XQuery/output /var/XQuery/simpleXQuery.txt
This compiles the XQuery expression provided in /var/XQuery/simpleXQuery.txt and places the resulting files in /var/XQuery/output/com/examples.
Load a precompiled executable
Precompile using ANT tasks