Prerequisites
The Saxon download includes additional libraries in the lib
directory.
Some of these, such as JLine and the ICU libraries, are only needed for specific features.
The XML Resolver jar files are always required and must be placed on your classpath.
If Saxon is downloaded via Maven, the optional
and required dependencies are identified in the POM file.
The following software must be installed separately, it is not included with the Saxon download.
-
To run SaxonJ you need at least a Java VM, and preferably a Java development environment. SaxonJ 11 requires at least Java SE 8 (also known as JDK 1.8). It should also run under all subsequent Java versions, but this may not be fully tested.
-
SaxonJ has options to work with source trees constructed using DOM, JDOM2, XOM, DOM4J, or AXIOM:
-
To use SaxonJ with DOM, you do not need any extra code on your classpath. The DOM implementation must support DOM Level-3 interfaces, and the DOM must be built with namespace processing enabled. SaxonJ is tested with both the DOM implementation provided by the Apache Xerces parser, and the DOM that is packaged with the Oracle 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.
The DOM must be namespace-aware: this is typically set using the method
DocumentBuilderFactory.setNamespaceAware(true)
. This is not the default setting. -
For the other object models, JDOM2, XOM, DOM4J, and AXIOM, the supporting Saxon adapter code is integrated into the JAR files for SaxonJ-PE and SaxonJ-EE, but is available only as source code for SaxonJ-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
, and register it using the method registerExternalObjectModel on the Configuration object, or via the configuration file. (With SaxonJ-PE and SaxonJ-EE, the supported object models are registered automatically if the underlying code is found on the classpath.) Note that support for JDOM version 1 was dropped in SaxonJ 10.
-
By default SaxonJ 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. In the past Saxonica recommended using the Apache version of Xerces in preference to the built-in parser delivered with the JDK, but since JDK 8 the built-in parser appears to be equally reliable. The parser must be SAX2-compliant. All the relevant JAR files must be installed on your Java classpath.
SaxonJ will also work with a StAX parser. Generally speaking, StAX parsers are less robust and less interoperable 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. SaxonJ is tested with Woodstox 3.0.0.