Package net.sf.saxon.serialize
This package contains code for serializing trees using the standard W3C-defined serialization methods
(xml, html, text, etc). Additional Saxon-specific serialization methods are in package com.saxonica.serialize
.
Serialization in Saxon operates as a push-based event pipeline in which the components of the pipeline
implement the Receiver
interface.
This defines a class that accepts a stream of events, with one method
defined for each kind of event. The events are modelled on the design of SAX, but adapted
to the XPath data model and to the use of Saxon's NamePool. Attributes and namespaces are
notified individually after the start of the relevant element.
The pipeline for serialization is assembled by the SerializerFactory
based
on a supplied set of serialization parameters. Only those components needed for the chosen serialization
parameters are included in the pipeline; for example, a Unicode normalizer is inserted at the appropriate
place in the pipeline if Unicode normalization is requested in the serialization parameters.
The immediate output of node constructors in a query or stylesheet goes to a Outputter
.
This is a subclass of Receiver
that can handle an arbitrary sequence, containing atomic values
as well as nodes. When constructing the content of an element, a ComplexContentOutputter
is used;
when constructing the content of a node such as a text node or attribute, a SequenceOutputter
is used instead.
The final serialization classes are subclasses of Emitter
, but much of the
serialization work
(such as indentation or application of character maps) is done by other classes on the pipeline. These
are generally constructed by extending the ProxyReceiver
class.
The Emitter is an abstract implementation of the Receiver interface. As well as supporting the Receiver interface, it provides methods for controlling the destination of serialized output (a Writer or OutputStream) and for setting serialization properties (in a Properties object). In practice nearly all the implementations of Receiver are currently subclasses of Emitter, but this may change in the future.
The package includes emitters for the standard output methods xml, html, and text, and proxy emitters to allow a sequence of filters to be applied to the output.
,-
Interface Summary Interface Description CharacterReferenceGenerator A class that expands a character to a character reference, entity reference, etc, and writes the resulting reference to a writer -
Class Summary Class Description AdaptiveEmitter This class implements the Adaptive serialization method defined in XSLT+XQuery Serialization 3.1.BinaryTextDecoder This class generates decodes processing instructions in text output that represent text encoded in base64 binary or hexBinaryCDATAFilter CDATAFilter: This ProxyReceiver converts character data to CDATA sections, if the character data belongs to one of a set of element types to be handled this way.CharacterMap This class defines a character map, that is, a mapping from characters to strings used by the serializer when mapping individual characters in the output.CharacterMapExpander CharacterMapExpander: This ProxyReceiver expands characters occurring in a character map, as specified by the XSLT 2.0 xsl:character-map declarationCharacterMapIndex This class represents a set of named character maps.Emitter Emitter: This abstract class defines methods that must be implemented by components that format SAXON output.ExpandedStreamResult An ExpandedStreamResult is similar to a StreamResult, and is created from a StreamResult.HexCharacterReferenceGenerator A class that represents a character as a hexadecimal character reference and writes the result to a supplied WriterHTML40Emitter This class generates HTML 4.0 outputHTML50Emitter This class generates HTML 5.0 outputHTMLEmitter This class generates HTML outputHTMLIndenter HTMLIndenter: This ProxyReceiver indents HTML elements, by adding whitespace character data where appropriate.HTMLTagHashSet A simple class for testing membership of a fixed set of case-insensitive ASCII strings.HTMLURIEscaper This class is used as a filter on the serialization pipeline; it performs the function of escaping URI-valued attributes in HTMLJSONEmitter This class implements the back-end text generation of the JSON serialization method.JSONSerializer This class implements the JSON serialization method defined in XSLT+XQuery Serialization 3.1.MessageEmitter MessageEmitter is the default Receiver for xsl:message output.MessageWarner MessageWarner is a user-selectable receiver for XSLT xsl:message output.MetaTagAdjuster The MetaTagAdjuster adds a meta element to the content of the head element, indicating the required content type and encoding; it also removes any existing meta element containing this informationPrincipalOutputGatekeeper This class is added to the output pipeline for the principal result destination for a transformation if the transformation uses xsl:result-document instructions.SerializationParamsHandler This class handles a set of serialization parameters provided in the form of an XDM instance as specified in the Serialization 3.0 definition, section 3.1SerializationProperties Define a set of serialization properties.TEXTEmitter This class generates TEXT outputUncommittedSerializer This class is used when the decision on which serialization method to use has to be delayed until the first element is read.UnicodeNormalizer UnicodeNormalizer: This ProxyReceiver performs unicode normalization on the contents of attribute and text nodes.UTF8Writer Specialized buffering UTF-8 writer.XHTML1Emitter XHTMLEmitter is an Emitter that generates XHTML 1 output.XHTML5Emitter XHTML5Emitter is an Emitter that generates XHTML 5 output.XHTMLPrefixRemover Filter to change elements in the XHTML, SVG, or MathML namespaces so they have no prefix (that is, to make these the default namespace).XHTMLURIEscaper This class performs URI escaping for the XHTML output method.XML10ContentChecker This class is used on the serialization pipeline to check that the document conforms to XML 1.0 rules.XMLEmitter XMLEmitter is an Emitter that generates XML output to a specified destination.XMLIndenter XMLIndenter: This ProxyReceiver indents elements, by adding character data where appropriate.