apache > cocoon

Text Serializer

Text Serializer

The Text serializer serializes xml into plain text..

  • Name : text
  • Class: org.apache.cocoon.serialization.TextSerializer
  • Cacheable: yes.

Sitemap Configuration

The text Serializer is declared in the sitemap serializers section.

 <map:serializer name="text" 

The text Serializer sets the method property of the XML serializer to the value text.

Pipeline Usage

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

<map:match pattern="announcement.txt">
<map:serialize type="text"/>

The pipeline snippet above serializes the SAX events of the announcment document resource to plain text.

Input document of the text serializer must be valid XML document. It should have at least one element, root element, which will contain all the text of the document. Root element will be ignored by text serializer and will not go into the output stream.

Further Reading

As text 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.