JAXP interface (transformation, XPath, schema processing)
Saxon 8.2 implements APIs defined in JAXP 1.3 (JAXP is the Java API for XML Processing). JAXP 1.3
is a standard component in JDK 1.5, but if you are using JDK 1.4, it must be installed separately.
For licensing reasons the JAXP package is not included in the Saxon distribution; instead you must
download it separately from https://jaxp.dev.java.net/.
This download includes two JAR files, jaxp-api.jar
and dom.jar
, which
must be present on the classpath when running Saxon under JDK 1.4. Note that this means you cannot
invoke Saxon
using the -jar
option, since this requires all files to be present in a single JAR archive,
and ignores the CLASSPATH setting.
The JAXP 1.3 XPath API is supported. This allows XPath expressions to be evaluated programmatically
from a Java application. The underlying tree structure can be any implementation of the Saxon Object Model
(the NodeInfo
interface), or a DOM, or JDOM, or XOM. For full details, see
The XPath API.
This has been achieved largely by making the existing classes in the old Saxon XPath API implement
the new JAXP interfaces. Existing applications using the old interfaces should for the most part continue
to work unchanged, and can be migrated to use the new JAXP methods when the opportunity arises.
Note however that the old XPathExpression
class has been renamed XPathExpressionImpl
to void confusion with the JAXP interface named XPathExpression
(which XPathExpressionImpl
now implements).
Some applications will probably want to continue to use the native Saxon methods, because the JAXP
interface is oriented towards XPath 1.0 rather than 2.0: although the Saxon implementation supports
XPath 2.0, the JAXP interface imposes limitations in the way that results are returned.
To generalize the handling of external object models, a new interface ExternalObjectModel
has been introduced, which is implemented by each object model. External object models can be registered
with the Configuration
, and there is a method in the Configuration
to search
for the object model implementation that supports a given class of node. This doesn't quite allow new
object models to be plugged into Saxon without source code change, but it gets close.
The QNameValue
class can convert between a Saxon QNameValue
and a JAXP QName
. Conversion between these two classes is also supported when
calling Java extension functions and when passing stylesheet parameters.
The new Saxon NamespaceContextImpl
class acts as a bridge between Saxon's
NamespaceResolver
and the equivalent JAXP 1.3 NamespaceContext
interface.
This allows any implementation of Saxon's NamespaceResolver
to be wrapped as a
JAXP 1.3 NamespaceContext
.
The nodes in Saxon's standard tree and tinytree models now implement the DOM Level 3 Node interface.
Saxon-SA 8.2 also supports the JAXP 1.3 schema validation API. For details, see schema processing.