JAXP 1.2 examples

Saxon supports the Java JAXP 1.2 API, also known as TrAX (package javax.xml.transform) for invoking the stylesheet processor. This API is useful when you want to write your own Java applications that invoke Saxon.

A sample program that illustrates many features of the TrAX interface is included in the distribution as TraxExamples.java. Source XML and XSLT files for use with this program are included in the trax directory. To run the program, use the command:

cd $saxonhome/samples/trax
java TraxExamples

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.

One of the examples shows how to use TrAX to process input from a third-party (non-Saxon) DOM document, and how to send output to a third-party DOM document. This example tests to see if either Crimson or Xerces is present on the classpath; if not, it should fail cleanly. You will need to change the source code and recompile if you want to use it with a different DOM implementation.

Expand

Next