org.apache.cocoon.sax.component
Class TextSerializer

java.lang.Object
  extended by org.apache.cocoon.xml.sax.AbstractSAXProducer
      extended by org.apache.cocoon.xml.sax.AbstractSAXPipe
          extended by org.apache.cocoon.sax.util.SAXConsumerAdapter
              extended by org.apache.cocoon.sax.AbstractSAXSerializer
                  extended by org.apache.cocoon.sax.component.XMLSerializer
                      extended by org.apache.cocoon.sax.component.TextSerializer
All Implemented Interfaces:
CachingPipelineComponent, Consumer, Finisher, PipelineComponent, SAXConsumer, SAXPipelineComponent, ContentHandler, LexicalHandler

public class TextSerializer
extends XMLSerializer

Converts XML into plain text. It omits all XML tags and writes only character events to the output. Input document must have at least one element - root element - which should wrap all the text inside it.


Field Summary
 
Fields inherited from class org.apache.cocoon.xml.sax.AbstractSAXProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler
 
Constructor Summary
TextSerializer()
           
 
Method Summary
 void characters(char[] c, int start, int len)
           
static TextSerializer createPlainSerializer()
           
 void endDocument()
           
 void endDTD()
           
 void endElement(String uri, String name, String raw)
           
 void processingInstruction(String target, String data)
           
 void recycle()
           
 void setDocumentLocator(Locator locator)
           
 void startDTD(String name, String publicId, String systemId)
           
 void startElement(String uri, String loc, String raw, Attributes a)
           
 
Methods inherited from class org.apache.cocoon.sax.component.XMLSerializer
constructCacheKey, createHTML4Serializer, createXHTMLSerializer, createXMLSerializer, getFormat, setCDataSectionElements, setDoctypePublic, setDoctypeSystem, setEncoding, setFormat, setIndent, setMediaType, setMethod, setOmitXmlDeclaration, setOutputStream, setStandAlone, setup, setVersion
 
Methods inherited from class org.apache.cocoon.sax.AbstractSAXSerializer
getConfiguration, getContentType, getInputParameters, getOutputStream, setConfiguration, setContentType, toString
 
Methods inherited from class org.apache.cocoon.sax.util.SAXConsumerAdapter
finish, getContentHandler
 
Methods inherited from class org.apache.cocoon.xml.sax.AbstractSAXPipe
comment, endCDATA, endEntity, endPrefixMapping, ignorableWhitespace, skippedEntity, startCDATA, startDocument, startEntity, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.sax.AbstractSAXProducer
setContentHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.pipeline.component.PipelineComponent
finish
 
Methods inherited from interface org.xml.sax.ContentHandler
endPrefixMapping, ignorableWhitespace, skippedEntity, startDocument, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endEntity, startCDATA, startEntity
 

Constructor Detail

TextSerializer

public TextSerializer()
Method Detail

setDocumentLocator

public void setDocumentLocator(Locator locator)
Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class org.apache.cocoon.xml.sax.AbstractSAXPipe

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in class org.apache.cocoon.xml.sax.AbstractSAXPipe
Throws:
SAXException

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
Specified by:
startDTD in interface LexicalHandler
Overrides:
startDTD in class org.apache.cocoon.xml.sax.AbstractSAXPipe
Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
Specified by:
endDTD in interface LexicalHandler
Overrides:
endDTD in class org.apache.cocoon.xml.sax.AbstractSAXPipe
Throws:
SAXException

startElement

public void startElement(String uri,
                         String loc,
                         String raw,
                         Attributes a)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class org.apache.cocoon.xml.sax.AbstractSAXPipe
Throws:
SAXException

endElement

public void endElement(String uri,
                       String name,
                       String raw)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class org.apache.cocoon.xml.sax.AbstractSAXPipe
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class org.apache.cocoon.xml.sax.AbstractSAXPipe
Throws:
SAXException

characters

public void characters(char[] c,
                       int start,
                       int len)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class org.apache.cocoon.xml.sax.AbstractSAXPipe
Throws:
SAXException - if text is encountered before root element.

recycle

public void recycle()
Overrides:
recycle in class org.apache.cocoon.xml.sax.AbstractSAXProducer

createPlainSerializer

public static TextSerializer createPlainSerializer()


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.