This section describes how to use Saxon as a Java class library, without making any use of XSLT stylesheets. It includes information on the XPath API, and the API for the Saxon implementation of the XPath object model. On other pages you will find the API for XSLT transformation, the API for running XQuery, and the API for Schema validation.
For information about the different ways of loading source documents, see Handling Source Documents.
The first section below describes the XPath API. This allows a Java application to execute XPath expressions against a source document, and manipulate the results. No stylesheet is involved.
Saxon implements and extends the XPath API defined in JAXP 1.3, so it should be possible to write applications that are portable between Saxon and other products implementing this interface. However, there are some differences in the Saxon implementation, noted below. Some of the extensions to this interface are provided because Saxon supports XPath 2.0, whereas JAXP 1.3 is designed primarily for XPath 1.0; some are provided because Saxon supports multiple object models, not only DOM; some are for backwards compatibility; and some are provided to allow applications a finer level of control if required.
JAXP 1.3 is available as a standard part of JDK 1.5 (also referred to as Java 5). It can be installed as an add-on to JDK 1.4, but unfortunately Sun's license for this add-on does not allow redistribution. It must therefore be installed separately. To work around the problems this causes, especially for users who want to embed Saxon in products that are then distributed further, Saxon also provides a standalone XPath API that is not dependent on JAXP 1.3.
The classes that deliver the JAXP XPath API support are in package net.sf.saxon.xpath
,
which is delivered in the separate JAR file saxon9-xpath.jar
. Saxon's standalone XPath API
is in package net.sf.saxon.sxpath
, which is included in the standard JAR file saxon9.jar
(for Saxon-B) or saxon9sa.jar
(for Saxon-SA).
In addition to the APIs described here, Saxon's JavaDoc documentation describes all the public classes and methods that are available for advanced users. These are all subject to change from one release to the next.