[AIX HP-UX Linux Solaris Windows]This topic applies only on the z/OS operating system.

Precompiling in Java

You can use the XCompilationFactory interface and its various compile and load methods to compile an expression, query, or stylesheet in advance. The Java™ classes can be loaded at execution time, therefore avoiding the cost of compilation in the application run time.

Procedure

Example

The following is a basic example of precompiling an XPath expression.
// Create the factory
XFactory factory = XFactory.newInstance();
               
// Get the compilation factory
XCompilationFactory compileFactory = factory.getCompilationFactory();
       
// Create the compilation parameters
XCompilationParameters params = compileFactory.newCompilationParameters("MyXPath");
params.setPackageName("org.example.myxpath");
                
// Generate the compiled classes
compileFactory.compileXPath("/doc/item[@id > 3000]", params);

Appropriate compile methods are available for XQuery and XSLT as well.




Related information
Precompiling using the command-line tools
Loading a precompiled executable
Task topic    

Terms of Use | Feedback

Last updated: Oct 21, 2010 1:06:41 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v700xml&product=was-nd-mp&topic=txml_precompiling_java
File name: txml_precompiling_java.html