Prerequisites
The following software must be installed separately, it is not included with the Saxon download.
-
To run Saxon you need at least a Java VM, and preferably a Java development environment. Saxon 9.3 requires JDK 1.5 (properly the Java 2 Platform, Standard Edition 5.0) or later (it also runs under JDK 1.6). If for some reason you need to run under JDK 1.4, you will need to stick with Saxon 9.1 or an earlier release.
-
If you use the XQJ XQuery API in Saxon, then you will need the StAX parser interfaces to be present on your classpath. These are available as standard in JDK 1.6. With JDK 1.5, however, you will need to install them separately. They can be obtained in the file
jsr173_1.0_api.jar
obtainable from https://sjsxp.dev.java.net/. -
Saxon will also accept input from a
StAXSource
. This is a new class introduced in JAXP 1.4. It is available as standard in JDK 1.6, but to use it with JDK 1.5, you will need to install it separately: it can be found in the JAR filejaxp-api.jar
which can be downloaded from https://jaxp.dev.java.net/. -
Saxon has options to work with source trees constructed using DOM, JDOM, JDOM2, XOM, or DOM4J:
-
To use Saxon with DOM, you do not need any extra code on your classpath. (The relevant code has been integrated into the main JAR file; this has become possible because JDK 1.4 is no longer supported.) The DOM implementation should support DOM Level-3 interfaces. Saxon retains some legacy code designed to handle level-2 DOM implementations, which can be activated by calling the method
configuration.setDOMLevel(2)
on classnet.sf.saxon.Configuration
, but this code is now untested and unsupported. Saxon is validated using the DOM implementation by the Apache Xerces parser, and the DOM that is packaged with the Sun JDK. It should work with other DOM implementations, but this can never be 100% guaranteed without testing. Many DOM implementations, especially non-productized implementations, deviate in minor but significant ways from the specifications. -
For the other object models, JDOM, JDOM2, XOM, and DOM4J, the supporting Saxon adapter code is integrated into the JAR files for Saxon-PE and Saxon-EE, but is available only as source code for Saxon-HE. To exploit this code with the open source Home Edition, you will need to compile the source code from the relevant subpackage of
net.sf.saxon.option
. Whichever edition you are using, the external object model is available for use only if you register it using the methodregisterExternalObjectModel
on theConfiguration
object, or via the configuration file. Saxon no longer searches the classpath to see which object models are present, because classpath searches are expensive and make the application over-sensitive to details of the way it is run. -
An exception to the previous paragraph: when Saxon is loaded using the JAXP
XPathFactory
mechanism, the support modules for JDOM, JDOM2, XOM, and DOM4J are registered automatically, provided that the underlying JDOM, JDOM2, XOM, or DOM4J JAR files are on the classpath. This is because Saxon'sXPathFactory
implementation registers itself using the Java service mechanism as being able to handle these object models, so it must honor this promise. -
Saxon has been validated with JDOM 1.0, JDOM 1.1.1, XOM 1.1, XOM 1.2.1, XOM 1.2.6, and DOM4J 1.6.1. Saxon has not been tested with the alpha release of DOM4J 2.0.0 (which at the time of writing has been at alpha status for 18 months). Preliminary testing has been carried out with JDOM 2, but this interface is not released with Saxon 9.4 because JDOM 2 is not yet sufficiently stable.
-
By default Saxon uses an XML parser that supports the SAX2 interface. Saxon has been tested successfully in the past with a wide variety of such parsers including Ælfred, Xerces, Lark, SUN Project X, Crimson, Piccolo, Oracle XML, xerces, xml4j, and xp. By default, however, it uses the parser that comes with the Java platform (a version of Xerces in the case of JDK 1.5). The parser must be SAX2-compliant. All the relevant JAR files must be installed on your Java CLASSPATH.
Saxon will also work with a StAX parser. Generally speaking, StAX parsers are currently less mature than SAX parsers, and any performance advantage is likely to be very minor. However, the support for StAX provides the ability to supply input via a customized pull pipeline. Saxon is tested with Woodstox 3.0.0. Saxon's schema validation is available only with a SAX2 parser.