S9API interface

Support for new Java date/time system

XdmAtomicValue provides additional constructors and getter methods supporting conversion to or from: java.time.Instant, java.time.LocalDateTime, java.time.OffsetDateTime, java.time.ZonedDateTime, and java.time.LocalDate.

Tree Construction APIs

Two new APIs have been introduced to make construction of XDM trees easier. One is oriented to construction of in-memory documents, the other is an event-based push API:

Serialization

The s9api Serializer object has new methods allowing any JAXP Source to be serialized. This allows for direct pass-through from an XML parser to a serializer (for example, to add indenting), for serialization of DOM trees, Sapling trees, and trees in third-party tree models.

XSLT and default namespaces

The XsltCompiler object has two new properties that can be set:

ErrorListener and ErrorReporter

A new mechanism for reporting errors to user applications has been introduced. The new ErrorReporter interface is a functional replacement for the old ErrorListener, though the ErrorListener interfaces are retained for the time being for backwards compatibility.

The ErrorListener class as defined in JAXP has a number of disadvantages:

The replacement ErrorReporter interface has a single method (report), and is defined as a Java FunctionalInterface, which makes it convenient to supply an ErrorReporter in the form of a lambda expression. The object passed to the report() method (in general, an XmlProcessingError) is not itself an exception (though in some cases it may wrap an exception), which means that Saxon does not have to create exception objects unnecessarily. The report() method throws no checked exceptions. The severity of the error (warning, error, or fatal) is defined as a property of the error object, rather than being distinguished by calling different methods of the error handler. The error handler is allowed to upgrade the severity of the error.

Interfaces at the s9api level continue to accept an ErrorListener for backwards compatibility, but the methods have been deprecated. Interfaces deeper in the Saxon internals have dropped support for the ErrorListener.

In previous releases, although it was not documented, an ErrorListener that was set on the XsltCompiler was inherited by any XsltTransformer or Xslt30Transformer created from that XsltCompiler. This is no longer the case (and the same is true if an ErrorList or ErrorReporter is provided).

XPathCompiler

A new method is added for XPathCompiler: addXsltFunctionLibrary(). This takes an XsltPackage as argument, representing a compiled XSLT 3.0 library package. The global public functions in the package (those declared using <xsl:function visibility='public'>) become available for calling from XPath expressions compiled using this XPathCompiler.