Project

Profile

Help

How to connect?
Download (2.98 KB) Statistics
| Branch: | Tag: | Revision:

he / latest9.1 / bj / net / sf / saxon / s9api / package.html @ e8aca6ed

1
<html>
2

    
3
<head>
4
<title>Package overview for net.sf.saxon.s9api</title>
5
</head>
6

    
7
<body>
8

    
9
<p>This package provides a Java API for Saxon that hides as much as possible of the detail of the
10
implementation. However, the API architecture faithfully reflects the internal architecture
11
of the Saxon product, unlike standard APIs such as JAXP and XQJ which in many cases force
12
compromises in the design of the application.</p>
13

    
14
<p>An application starts by loading a <code>Processor</code>, which allows configuration options
15
to be set. As far as possible, an application should instantiate a single <code>Processor</code>.</p>
16

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

    
28
<p>In the schema-aware product the <code>Processor</code> owns a <code>SchemaManager</code> that holds
29
the cache of schema components and can be used to load new schema components from source schema documents.
30
It can also be used to create a <code>SchemaValidator</code>, which in turn is used to validate instance
31
documents.</p>
32

    
33
<p>Source documents can be constructed using a <code>DocumentBuilder</code>, which holds all the options
34
and parameters to control document building.</p>
35

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

    
40
<p>There are classes to represent the objects of the XDM data model, including <code>XDMValue</code>,
41
<code>XDMItem</code>, <code>XDMNode</code>, and <code>XDMAtomicValue</code>.</p>
42

    
43
<p>The s9api interface is designed to take advantage of Java 5 constructs such as generics and
44
iterables. Although the main Saxon run-time continues to work under JDK 1.4, the s9api interface cannot 
45
be used without upgrading to Java 5. For this reason it is in a separate JAR file.</p>
46

    
47
<hr>
48

    
49
<p align="center"><i>Michael H. Kay<br/>
50
Saxonica Limited<br/>
51
27 September 2007</i></p>
52
</body>
53
</html>
(37-37/37)