プリコンパイルされた実行可能ファイルのロード
XCompilationFactory インターフェースとそのインターフェースのさまざまなロード・メソッドを使用して、 プリコンパイルされた式、照会、またはスタイルシートをロードできます。 これらのロード・メソッドは Java™ クラスをロードし、 それぞれ XPathExecutable、XQueryExecutable、XSLTExecutable オブジェクトを返します。
手順
例
以下に、プリコンパイルされた XPath 式をロードする基本的な例を示します。
// 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);
さらに、XQuery および XSLT にも適切なロード・メソッドを使用できます。