사전 컴파일된 실행 파일 로드
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에 대해서도 적절한 로드 메소드가 사용 가능합니다.