org.apache.cocoon.serialization
Class AbstractTextSerializer

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.xml.AbstractXMLProducer
              |
              +--org.apache.cocoon.xml.AbstractXMLPipe
                    |
                    +--org.apache.cocoon.serialization.AbstractSerializer
                          |
                          +--org.apache.cocoon.serialization.AbstractTextSerializer
All Implemented Interfaces:
Cacheable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, Serializer, SitemapOutputComponent, XMLConsumer, XMLPipe, XMLProducer
Direct Known Subclasses:
HTMLSerializer, TextSerializer, XMLSerializer

public abstract class AbstractTextSerializer
extends AbstractSerializer
implements org.apache.avalon.framework.configuration.Configurable, Cacheable, org.apache.avalon.excalibur.pool.Poolable

Version:
CVS $Revision: 1.2.2.7 $ $Date: 2001/11/01 09:44:33 $
Author:
Pierpaolo Fumagalli (Apache Software Foundation, Exoffice Technologies), Stefano Mazzocchi, Sylvain Wallez

Field Summary
protected  java.util.Properties format
          The Properties used by this serializer.
 
Fields inherited from class org.apache.cocoon.serialization.AbstractSerializer
output
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.serialization.Serializer
ROLE
 
Constructor Summary
AbstractTextSerializer()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
          Set the configurations for this serializer.
 void endElement(java.lang.String eltUri, java.lang.String eltLocalName, java.lang.String eltQName)
          Receive notification of the end of an element.
 void endPrefixMapping(java.lang.String prefix)
          End the scope of a prefix-URI mapping: remove entry from mapping tables.
 long generateKey()
          Generate the unique key.
 CacheValidity generateValidity()
          Generate the validity object.
protected  javax.xml.transform.sax.SAXTransformerFactory getTransformerFactory()
          Helper for TransformerFactory.
 void recycle()
          Recycle serializer by removing references
 void setOutputStream(java.io.OutputStream out)
          Set the OutputStream where the XML should be serialized.
 void startDocument()
          Receive notification of the beginning of a document.
 void startElement(java.lang.String eltUri, java.lang.String eltLocalName, java.lang.String eltQName, org.xml.sax.Attributes attrs)
          Ensure all namespace declarations are present as xmlns: attributes and add those needed before calling superclass.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Add tracking of mappings to be able to add xmlns: attributes in startElement().
 
Methods inherited from class org.apache.cocoon.serialization.AbstractSerializer
getMimeType, shouldSetContentLength
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDocument, endDTD, endEntity, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startEntity
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

format

protected java.util.Properties format
The Properties used by this serializer.
Constructor Detail

AbstractTextSerializer

public AbstractTextSerializer()
Method Detail

getTransformerFactory

protected javax.xml.transform.sax.SAXTransformerFactory getTransformerFactory()
Helper for TransformerFactory.

setOutputStream

public void setOutputStream(java.io.OutputStream out)
Set the OutputStream where the XML should be serialized.
Overrides:
setOutputStream in class AbstractSerializer

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Set the configurations for this serializer.
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable

generateKey

public long generateKey()
Generate the unique key. This key must be unique inside the space of this component. This method must be invoked before the generateValidity() method.
Specified by:
generateKey in interface Cacheable
Returns:
The generated key or 0 if the component is currently not cacheable.

generateValidity

public CacheValidity generateValidity()
Generate the validity object. Before this method can be invoked the generateKey() method must be invoked.
Specified by:
generateValidity in interface Cacheable
Returns:
The generated validity object or null if the component is currently not cacheable.

recycle

public void recycle()
Recycle serializer by removing references
Overrides:
recycle in class AbstractSerializer

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Description copied from class: AbstractXMLPipe
Receive notification of the beginning of a document.
Overrides:
startDocument in class AbstractXMLPipe

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Add tracking of mappings to be able to add xmlns: attributes in startElement().
Overrides:
startPrefixMapping in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
prefix - The Namespace prefix being declared.
uri - The Namespace URI the prefix is mapped to.

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
End the scope of a prefix-URI mapping: remove entry from mapping tables.
Overrides:
endPrefixMapping in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
prefix - The prefix that was being mapping.

startElement

public void startElement(java.lang.String eltUri,
                         java.lang.String eltLocalName,
                         java.lang.String eltQName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Ensure all namespace declarations are present as xmlns: attributes and add those needed before calling superclass. This is a workaround for a Xalan bug (at least in version 2.0.1) : org.apache.xalan.serialize.SerializerToXML ignores start/endPrefixMapping().
Overrides:
startElement in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
loc - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
a - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.

endElement

public void endElement(java.lang.String eltUri,
                       java.lang.String eltLocalName,
                       java.lang.String eltQName)
                throws org.xml.sax.SAXException
Receive notification of the end of an element. Try to restore the element qName.
Overrides:
endElement in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
loc - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.