Application Programming Interfaces
This section includes changes to the main s9api interface library, as well as other significant application programming interfaces
In s9api, an XQueryEvaluator is now a Destination, so queries can participate in s9api pipelines in the same way as transformations.
In s9api, the base output URI of an XsltTransformer is now taken from the Destination if (a) no base output URI has been explicitly set, and (b) the destination is a Serializer writing to a supplied File.
A class XdmFunctionItem
has been added to both s9api and the Saxon.NET API to represent
items that are functions (as distinct from atomic values and nodes).
It is now possible to set a default collection and a collection URI resolver at the
level of the Controller (that is, an individual
transformation or query); previously it could only be set globally, in the
Configuration. There is now a
defined constant URI (Collection.EMPTY_COLLECTION
) which always
represents an empty collection, without needing to be resolved by the URI resolver.
It is now possible to set an extension function library at the level of an individual query (via the StaticQueryContext object), or an individudual stylesheet (via the CompilerInfo object. Previously an extension function library could only be defined at the Configuration level.
In the JAXP XPathFactory
implementation, Saxon configuration properties
(as listed in FeatureKeys) can now be supplied to the getFeature()
and setFeature()
methods, provided the properties are of type boolean.
A new class Transmitter
is available as a new kind of
JAXP Source
, recognized in all Saxon interfaces that accept a Source
.
A Transmitter writes events to a Receiver.
This is useful when the input to a streamed transformation is supplied programmatically.
A new simplified interface for defining context-free extension functions is available as part of the s9api package: Processor.registerExtensionFunction, where the argument implements the interface ExtensionFunction.
Saxon now recognizes the class StAXResult
in interfaces where a Result
is expected,
specifically in the JAXP interfaces for transformation and validation. The StAXResult
object
must contain an XMLStreamWriter
(Saxon does not yet support XMLEventWriter
). Because
StAXResult
and other StAX classes are dependent on JDK 1.6, this code has been packaged in a
separate JAR file, which must be on the classpath if the functionality is required.