Package net.sf.saxon.s9api


package net.sf.saxon.s9api

This package provides Saxon's preferred Java API for XSLT, XQuery, XPath, and XML Schema processing. Unlike standard Java APIs such as JAXP and XQJ, this API provides a consistent and integrated approach to the entire functionality of the Saxon product.

An application starts by loading a Processor, which allows configuration options to be set. Whenever possible, an application should instantiate a single Processor and use it for the duration of the application, across all threads.

The interfaces for XSLT, XQuery, and XPath processing all follow the same pattern. There is a three-stage execution model: first a compiler is created using a factory method in the Processor object. The compiler holds compile-time options and the static context information. Then the compiler's compile() method is called to create an executable, a representation of the compiled stylesheet, query, or expression. This is thread-safe and immutable once created. To run the query or transformation, first call the load() method to create a run-time object called variously an XsltTransformer, XQueryEvaluator, or XPathSelector. This holds run-time context information such as parameter settings and the initial context node; the object is therefore not shareable and should only be run in a single thread; indeed it should normally only be used once. This object also provides methods allowing the transformation or query to be executed.

The interfaces for schema processing in Saxon-EE have changed a little in Saxon 13 to accommodate the fact that a Processor can now hold multiple schemas, each of which can be used independently (previously multiple schema documents could be loaded, but they were all aggregated into a single schema). A schema is represented by the class XsdSchema, and is built using an XsdCompiler obtained from the Processor. The XsdSchema can be used to create a SchemaValidator for validating instance documents, and it can be supplied to an XSLT, XQuery, or XPath compiler for executing schema-aware transformations and queries.

Source documents can be constructed using a DocumentBuilder, which holds all the options and parameters to control document building.

The output of a transformation, or of any other process that generates an XML tree, can be sent to a Destination. There are a number of implementations of this interface, including a Serializer which translates the XML document tree into lexical XML form.

There are classes to represent the objects of the XDM data model, including XdmValue, XdmItem, XdmNode, and XdmAtomicValue. These can be manipulated using methods based on the Java 8 streams processing model: for details see package net.sf.saxon.s9api.streams.


  • Class
    Description
    An abstract class providing reusable code for implementing the Destination interface
    A class that exists to contain common code shared between XsltTransformer and Xslt30Transformer.
    A completely general functional interface for functions that take no arguments, return void, and potentially throw a SaxonApiException.
    This is an enumeration class containing constants representing the thirteen axes available in XPath versions from 1.0 to 3.1, together with four new axes defined experimentally in XPath 4.0.
    A SAX ContentHandler that builds a Saxon tree, and allows the node at the root of the tree to be retrieved on completion.
    A BuildingStreamWriter allows a document to be constructed by calling the methods defined in the XMLStreamWriter interface; after the document has been constructed, its root node may be retrieved by calling the BuildingStreamWriter.getDocumentNode() method.
    A Destination represents a place where XDM values can be sent.
    A helper class for implementing the Destination interface.
    A document builder holds properties controlling how a Saxon document tree should be built, and provides methods to invoke the tree construction.
    This class represents a Destination (for example, the destination of the output of a transformation) in which the results are written to a newly constructed DOM tree in memory.
    This is an interface for simple external/extension functions.
    Identifies a host language in which XPath expressions appear.
    An item type, as defined in the XPath/XQuery specifications.
    ItemType representing a built-in atomic type
    This class is used for creating ItemType objects.
    A JsonBuilder is used to parse JSON documents.
    Saxon interface to represent a location, typically the location of an expression within a query or stylesheet.
    A Message represents the output of an xsl:message or xsl:assert instruction.
    A user-written implementation of the MessageListener interface may be registered with the XsltTransformer to receive notification of xsl:message output.
    Deprecated.
    A NullDestination is a Destination that discards all output sent to it.
    Represents one of the possible occurrence indicators in a SequenceType.
    The Processor class serves three purposes: it allows global Saxon configuration options to be set; it acts as a factory for generating XQuery, XPath, and XSLT compilers; and it owns certain shared resources such as the Saxon NamePool and compiled schemas.
    The QName class represents an instance of xs:QName, as defined in the XPath data model.
    An RawDestination is a Destination that accepts a sequence output by a stylesheet or query and returns it directly as an XdmValue, without constructing an XML tree, and without serialization.
    This class represents a Destination (for example, the destination of the output of a transformation) in which events representing the XML document are sent to a user-supplied SAX2 ContentHandler, as if the ContentHandler were receiving the document directly from an XML parser.
    An exception thrown by the Saxon s9api API.
    An unchecked exception thrown by the Saxon API.
    Deprecated.
    since Saxon 13.0 - use XsdCompiler
    A SchemaValidator is an object that is used for validating instance documents against a schema.
    A SequenceType is the combination of an ItemType and an OccurrenceIndicator.
    A Serializer takes an XDM value and outputs a textual representation of the content.
    Enumeration class defining the permitted serialization properties.
    A TeeDestination allows writing to two destinations at once.
    An enumeration defining possible strategies for resolving unprefixed element names appearing as name tests in the steps of a path expression or XSLT match pattern
    Enumeration class defining different schema validation (or construction) modes
    WhitespaceStrippingPolicy is class defining the possible policies for handling whitespace text nodes in a source document.
    An array in the XDM data model.
    The class XdmAtomicValue represents an item in an XPath sequence that is an atomic value.
    An XdmDestination is a Destination in which an XdmNode is constructed to hold the output of a query or transformation: that is, a tree using Saxon's implementation of the XDM data model
    The class XdmEmptySequence represents an empty sequence in the XDM Data Model.
    The class XdmExternalObject represents an XDM item that wraps an external (Java or .NET) object.
    The class XdmFunctionItem represents a function item.
    The class XdmItem represents an item in a sequence, as defined by the XDM data model.
    This class represents a JNode in the XDM data model.
    A map in the XDM data model.
    This class represents a node in the XDM data model.
    Enumeration class defining the seven kinds of node defined in the XDM model
    An iterator over an XPath sequence.
    A value in the XDM data model.
    The XmlProcessingError class contains information about an error detected during compilation or execution of a stylesheet, query, XPath expression, or schema
    An XPathCompiler object allows XPath queries to be compiled.
    An XPathExecutable represents the compiled form of an XPath expression.
    An XPathSelector represents a compiled and loaded XPath expression ready for execution.
    An XQueryCompiler object allows XQuery queries to be compiled.
    An XQueryEvaluator represents a compiled and loaded query ready for execution.
    An XQueryExecutable represents the compiled form of a query.
    The XsdCompiler is used to load schema documents, and to set options for the way in which they are loaded.
    This class represents an XSD Schema - that is, a set of schema components, typically resulting from compiling a collection of one or more source schema documents.
    An Xslt30Transformer represents a compiled and loaded stylesheet ready for execution.
    An XsltCompiler object allows XSLT stylesheets to be compiled.
    An XsltExecutable represents the compiled form of a stylesheet.
    Inner class containing information about a global parameter to a compiled stylesheet
    An XsltPackage object represents the result of compiling an XSLT 3.0 package, as represented by an XML document containing an xsl:package element.
    An XsltTransformer represents a compiled and loaded stylesheet ready for execution.