| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
<html> |
| 9 |
|
| 10 |
<head> |
| 11 |
<title>Package overview for net.sf.saxon.serialize</title> |
| 12 |
</head> |
| 13 |
|
| 14 |
<body> |
| 15 |
|
| 16 |
<p>This package contains code for serializing trees using the standard W3C-defined serialization methods |
| 17 |
(xml, html, text, etc). Additional Saxon-specific serialization methods are in package {@link |
| 18 |
com.saxonica.serialize}.</p> |
| 19 |
|
| 20 |
<p>Serialization in Saxon operates as a push-based event pipeline in which the components of the pipeline |
| 21 |
implement the {@link net.sf.saxon.event.Receiver} interface. |
| 22 |
This defines a class that accepts a stream of events, with one method |
| 23 |
defined for each kind of event. The events are modelled on the design of SAX, but adapted |
| 24 |
to the XPath data model and to the use of Saxon's NamePool. Attributes and namespaces are |
| 25 |
notified individually <i>after</i> the start of the relevant element.</p> |
| 26 |
|
| 27 |
<p>The pipeline for serialization is assembled by the {@link net.sf.saxon.lib.SerializerFactory} based |
| 28 |
on a supplied set of serialization parameters. Only those components needed for the chosen serialization |
| 29 |
parameters are included in the pipeline; for example, a Unicode normalizer is inserted at the appropriate |
| 30 |
place in the pipeline if Unicode normalization is requested in the serialization parameters.</p> |
| 31 |
|
| 32 |
<p>The immediate output of node constructors in a query or stylesheet goes to a {@link |
| 33 |
net.sf.saxon.event.SequenceReceiver}. |
| 34 |
This is a subclass of <code>Receiver</code> that can handle an arbitrary sequence, containing atomic values |
| 35 |
as well as nodes. When constructing the content of an element, a {@link net.sf.saxon.event.ComplexContentOutputter} |
| 36 |
is used; |
| 37 |
when constructing the content of a node such as a text node or attribute, a <code>SequenceOutputter</code> |
| 38 |
is used instead.</p> |
| 39 |
|
| 40 |
<p>The final serialization classes are subclasses of {@link net.sf.saxon.serialize.Emitter}, but much of the |
| 41 |
serialization work |
| 42 |
(such as indentation or application of character maps) is done by other classes on the pipeline. These |
| 43 |
are generally constructed by extending the {@link net.sf.saxon.event.ProxyReceiver} class.</p> |
| 44 |
|
| 45 |
<p>The Emitter is an abstract implementation of the Receiver interface. As well as supporting |
| 46 |
the Receiver interface, it provides methods for controlling the destination of serialized output |
| 47 |
(a Writer or OutputStream) and for setting serialization properties (in a Properties object). |
| 48 |
In practice nearly all the implementations of Receiver are currently subclasses of Emitter, |
| 49 |
but this may change in the future.</p> |
| 50 |
|
| 51 |
<p>The package includes emitters for the standard output methods xml, html, and text, and |
| 52 |
proxy emitters to allow a sequence of filters to be applied to the output.</p>, |
| 53 |
|
| 54 |
|
| 55 |
</body> |
| 56 |
</html> |