cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Assaf Arkin <>
Subject Proposal for Serializer API
Date Tue, 15 Feb 2000 20:40:46 GMT
The purpose of the serializer API is to enable SAX events and DOM
documents to be written into a document. The serializer API allows any
implementation supporting any number of output formats (XML, HTML, PDF,
PNG, etc).

Originally this API was named serializer since it serializes a DOM
document into the output document, and is consistent with the term
'serializer' that XML and DOM specifications will refer to.

The serializer API assumes that a serializer implementation will exist,
whether or not an XSLT processor implementation exists, hence my
proposal to place it in a separate package. It does not assume, however,
that any given serializer implementation will be available.

Four output methods are defined by default (XML, HTML, XHTML, TEXT), so
implementations are encouraged to support all four.

The serializer API defines the following interfaces:

* SerializerFactory -- a way to acquire a new serializer for a given
output method

* Serializer --  a way to set the output format and output stream for a
serializer, and a way obtain a DocumentHandler (SAX1), ContentHandler
(SAX2) or DOMSerializer (DOM L1) for serializing

* OutputFormat -- basic set of output format properties based on
xsl:output. Implementations may use an extended class with additional
properties (e.g. indentation level, line separator, etc)

* Method -- a list of the four common output method names. Additional
methods should follow the uri:name pattern.

* QName -- QNames are used for CDATA and non-escaping elements

An implementation could roll all three serializers (SAX1, SAX2, DOM)
into one, or provide different implementations through the Serializer

By definition a Serializer is reusable. By changing the output
stream/output format, the same serializer can be used over and over.
However, a serializer is not multi-threaded -- it can only serialize one
document at any given time.

Currently there is no way to control namespace behavior. The serializer
will use the prefix/uris providers in the DOM/SAX events.

An XSLT processor may choose to use a serializer implementation, provide
a serializer implementation, or use it's internal mechanisms and ignore
this package all together. However, by supporting OutputFormat, the XSLT
processor allows the following to happen:

* A stylesheet is read using the XSLT processor and the OutputFormat is
returned to the application

* A document is transformed using the XSLT processor, and the resulting
document (DOM or SAX) is returned to the application

* The application performs further processing on the document, caching,
filtering, etc

* The application sends the document (DOM or SAX) to a serializer using
the OutputFormat read from the stylesheet



Assaf Arkin                                 
CTO, Exoffice Technologies, Inc.              
View raw message