JAXP interface (transformation, XPath, schema processing)
The ability to configure Saxon to use DOM Level 2 (the default is 3) at the configuration level is removed. It is retained at the level of the DOM DocumentWrapper, though it has not been tested for some time.
The JAXP Transformation API (also known as Trax) has been re-implemented as a layer on top of s9api.
The implementation classes are now in package net.sf.saxon.jaxp
, though the
factory class names are unchanged.
The internal redesign may affect applications that "down-cast" from the JAXP interfaces to
the Saxon implementation classes. For example, casting a JAXP Transformer
to
net.sf.saxon.Controller
will no longer work. The implementation classes remain
available via getter methods, so it should always be possible to convert such code so it
continues to work. For example, if you need to get the Controller
, you can cast
the Transformer
to net.sf.saxon.jaxp.TransformerImpl, and then call the method
getUnderlyingController()
.
The reason for this redesign is so that core classes such as Controller
and
PreparedStyleSheet
are no longer constrained to implement JAXP interfaces,
which is increasingly unviable as the limitations of the XSLT 1.0 processing model become
clearer. For example, it opens the door to a redesign to accommodate XSLT 3.0 packages.
Because Controller
no longer needs to implement the JAXP
Transformer
interface, it has been possible to drop some of its methods, for
example the weakly-typed versions of the methods for setting parameter values, such methods
now require the supplied value to be a Sequence
. Similarly, the
Controller
no longer has methods for setting and getting output properties.
In the JAXP XPath interface, various Saxon extensions (mostly deprecated methods) have been dropped, reflecting the fact that this interface is provided only for compatibility reasons, and applications requiring full use of Saxon functionality should be using the s9api interface.
Replacing the use of the JAXP ErrorListener
class proved too difficult, but most
classes now use an UnfailingErrorListener
, which is a subclass of
ErrorListener
that throws no exceptions. This has enabled the removal of a lot
of superfluous error-catching code.
The SchemaException
class, used to report errors in a schema, now has
TransformerException
rather than TransformerConfigurationException
as its base class. The main reason to extend TransformerException
is so that the
exception can be passed to a JAXP ErrorListener
.
The error handling in the JAXP SchemaFactory
, Validator
, and
ValidatorHandler
implementations has been changed to conform to the way it is
defined in the JAXP specifications. The default ErrorHandler
is now "null", which
gives draconian error handling (any validation error is fatal and causes immediate
termination). The ErrorHandler
may also be set explicitly to "null", with the
same meaning. Any ErrorHandler
supplied to the SchemaFactory
is used
only during schema processing, and is not inherited by Validator
and
ValidatorHandler
for use during instance validation; nor does it modify the
ErrorListener
registered with the Configuration
.
The Saxon JAR files no longer include the XPath service file causing them to be recognized by
a JAXP XPathFactory
search. Applications that use this search mechanism are
generally looking for an XPath 1.0 processor and can fail simply because Saxon is on the
classpath, which then gets reported as a Saxon problem. The JAXP interface to XPath remains
available (despite its many limitations), but the XPathFactory
must be
instantiated explicitly.