S9API examples

Saxon's s9api interface is a custom-designed interface for all XML processing. This API is useful when you want to write your own Java applications that invoke Saxon XSLT transforms, XQuery, and evaluate XPath expressions (for more information see Using s9api for transformations, Using s9api for XQuery, and Evaluating XPath expressions using s9api respectively).

A sample program that illustrates many features of the s9api interface is included in the saxon-resources download as S9APIExamples.java. To run the program, use the command:

cd samples
java he/S9APIExamples

You can supply an argument to indicate which of the examples you want to run; see the source code for details. By default, they are all executed in turn.

The additional sample program S9APIExamplesOM.java contains examples demonstrating XPath expressions evaluated against source documents supplied using different third-party object models: JDOM2, XOM, and DOM4J. To run the program, the classpath must include these third-party JAR files as well as Saxon. See JAR files for more information about running applications and the classpath, and Third-party object models for more information on the object models.