aSaxon-B-9-0-0-8sources.net.sf.saxon.s9api.package.html Maven / Gradle / Ivy
Show all versions of commons-xmlbeans Show documentation
Package overview for net.sf.saxon.s9api
This package provides a Java API for Saxon that hides as much as possible of the detail of the
implementation. However, the API architecture faithfully reflects the internal architecture
of the Saxon product, unlike standard APIs such as JAXP and XQJ which in many cases force
compromises in the design of the application.
An application starts by loading a Processor
, which allows configuration options
to be set. As far as possible, an application should instantiate a single Processor
.
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.
In the schema-aware product the Processor
owns a SchemaManager
that holds
the cache of schema components and can be used to load new schema components from source schema documents.
It can also be used to create a SchemaValidator
, which in turn is used to validate instance
documents.
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
.
The s9api interface is designed to take advantage of Java 5 constructs such as generics and
iterables. Although the main Saxon run-time continues to work under JDK 1.4, the s9api interface cannot
be used without upgrading to Java 5. For this reason it is in a separate JAR file.
Michael H. Kay
Saxonica Limited
27 September 2007