The end point of a Pipeline. Its inputs are SAX events. It outputs a presentation of those events. i.e. it performs the function of rendering the results of a request.
The basic Serializer turns a series of SAX events into an XML document.
Declaration
Serializers are configured in the Sitemap
<map:serializers default="html">
<map:serializer name="xml"
mime-type="text/xml"
src="org.apache.cocoon.serialization.XMLSerializer"/>
<map:serializer name="html"
mime-type="text/html"
src="org.apache.cocoon.serialization.HTMLSerializer"/>
<map:serializer name="fo2pdf"
mime-type="application/pdf"
src="org.apache.cocoon.serialization.FOPSerializer"/>
<map:serializer name="vrml"
mime-type="model/vrml"
src="org.apache.cocoon.serialization.TextSerializer"/>
<map:serializer name="text"
mime-type="text/plain"
src="org.apache.cocoon.serialization.TextSerializer"/>
...
</map:serializers>The default attribute on the serializers element indicates the default serializer to use if a pipeline does not explicitly declare one.
Usage
Sample usage:
<map:match pattern="hello.html"> <map:generate src="docs/samples/hello-page.xml"/> <map:transform src="stylesheets/page/simple-page2html.xsl"/> <map:serialize type="html"/> </map:match>
Available Implementations
Serializers are provided to produce HTML, XML, PDF, WAP, VRML, amongst others:
HTML_Serializer -- serializes XHTML into valid HTML
- XML Serializer -- simply turns SAX events into an XML document
- Text Serializer -- text-tags from XML
- WAP/WML Serializer -- ??
SVG Serializer -- converts SVG documents (may be slightly behind REC) into JPEG or PNG images, using Batik Transcoder
- SVG/XML Serializer -- ??
- VRML Serializer --
- Link Serializer --
PDF Serializer -- turns XSL:FO into PDF using FOP
PS Serializer -- turns XSL:FO into PS using FOP
PCL Serializer -- turns XSL:FO into PCS using FOP
XLSSerializer -- turns gnumeric formatted XML an ExcelGeneration
RTF Serializer -- turns XSL:FO into RTF using jfor (MS Word compatible)