apache > cocoon

- Home

# SVG/XML Serializer

The SVG serializer serializes sax events to SVG XML. The output of the SVG serializer is SVG XML; the SVG XML is not rasterized to any image format by this serializer.

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

### Sitemap Configuration

The SVG XML serializer is declared in the sitemap serializers section.

    <map:serializers ...
    ...
      <map:serializer name="xml"
        src="org.apache.cocoon.serialization.XMLSerializer"
        mime-type="text/xml"
        doctype-public="-//W3C//DTD SVG 1.0//EN"
        doctype-system="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd";
        logger="sitemap.serializer.xml"
        pool-max="32">
        <!-- serializer configurations -->
    ...
      </map:serializer>
    ...

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

Name | Value | Comment
--- | --- | ---
doctype-public | -//W3C//DTD SVG 1.0//EN | specifies the SVG XML public document type
doctype-system | http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd | specifies the SVG XML system document type
mime-type | text/xml | Following mime-type may be used, too: `image/svg+xml`, `application/xml`. The mime-type `text/xml` is the most general one.

### Pipeline Usage

Using the SVG XML serializer in a pipeline is just setting the serializer type to svgxml. The following code snippet uses the svxml serializer:

    <map:match pattern="svg">
    ...
      <map:serialize type="svgxml"/>
    </map:match>
    ...

### Further Reading

As SVG 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 documentation.

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).