Loading a precompiled executable

You can use the XCompilationFactory interface and its various load methods to load a precompiled expression, query, or stylesheet. These load methods load the Java classes and return an XPathExecutable, XQueryExecutable, or XSLTExecutable object respectively.

Procedure

Example

The following is a basic example of loading a precompiled 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");

// Load the executable
XPathExecutable executable = compileFactory.loadXPath(params);        

// Create the input source
StreamSource input = new StreamSource("simple.xml");

// Execute the XPath expression
XSequenceCursor cursor = executable.execute(input);

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




In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms of Use | Feedback

Last updatedLast updated: Sep 19, 2011 6:15:55 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-express-dist&topic=txml_loading
File name: txml_loading.html