apache > cocoon

- Home

# XHTML Serializer

The XHTML serializer serializes sax events to XHTML. The output of the XHTML serializer is XHTML.

- Name : xhtml
- Class: org.apache.cocoon.serialization.XMLSerializer
- Cacheable: yes

### Sitemap Configuration

The XHTML serializer is declared in the sitemap serializers section.

    <map:serializers ...
    ...
       <map:serializer name="xhtml"
         src="org.apache.cocoon.serialization.XMLSerializer"
         mime-type="text/html"
         logger="sitemap.serializer.xhtml"
         pool-max="64"
         >
         <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
         <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
         <encoding>UTF-8</encoding>
       </map:serializer>
    ...

The declaration of the XHTML serializer shall use following XML serializer configuration parameters

Name | Value | Comment
--- | --- | ---
doctype-public | -//W3C//DTD XHTML 1.0 Strict//EN | specifies the XHTML public document type
doctype-system | http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd | specifies the XHTML system document type
mime-type | text/html | specifies mime-type of the serialized XHTML document.

### Pipeline Usage

Using the XHTML Serializer in a pipeline is just setting the serializer type to xhtml. The following code snippet uses the XHTML Serializer:

    <map:match pattern="*.html">
    ...
      <map:serialize type="xhtml"/>
    </map:match>
    ...

### Further Reading

As XHTML serializer uses the XML serializer internally, you might want to read the complete list of valid XML configuration parameters. It is available at XML serializer user docuementation.

Errors and Improvements? If you see any errors or potential improvements in this document please help us: View, Edit or comment on the latest development version (registration required).