org.kabeja.xml
Class SAXPrettyOutputter

java.lang.Object
  extended by org.kabeja.processing.AbstractConfigurable
      extended by org.kabeja.xml.AbstractSAXSerializer
          extended by org.kabeja.xml.SAXPrettyOutputter
All Implemented Interfaces:
Configurable, SAXSerializer, org.xml.sax.ContentHandler
Direct Known Subclasses:
ConsoleSerializer

public class SAXPrettyOutputter
extends AbstractSAXSerializer
implements SAXSerializer

This outputs a SAXStream to an OutputStream with the given encoding or otherwise with the default encoding (utf-8).

Note: Not all features are implemented, so if you use this with other SAXStreams others then the Kabeja-SAXStream you will get broken XML-Documents.

Author:
Simon Mieth

Field Summary
static java.lang.String DEFAULT_ENCODING
           
protected  boolean gzip
           
static java.lang.String MIMETYPE
           
static java.lang.String PROPERTY_ENCODING
           
static java.lang.String PROPERTY_GZIP
           
protected  java.util.HashMap rootxmlns
           
static java.lang.String SUFFIX
           
static java.lang.String SUFFIX_GZIP
           
 
Fields inherited from class org.kabeja.processing.AbstractConfigurable
properties
 
Constructor Summary
SAXPrettyOutputter()
           
SAXPrettyOutputter(java.io.OutputStream out)
           
SAXPrettyOutputter(java.io.OutputStream output, java.lang.String encoding)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
static java.lang.String encodeXML(java.lang.String text)
           
 void endDocument()
           
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 void endPrefixMapping(java.lang.String prefix)
           
 java.lang.String getMimeType()
           
 java.lang.String getSuffix()
           
 void ignorableWhitespace(char[] ch, int start, int length)
           
 void processingInstruction(java.lang.String target, java.lang.String data)
           
protected  void queryXMLNS(org.xml.sax.Attributes atts)
           
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void setDTD(java.lang.String dtd)
           
 void setOutput(java.io.OutputStream out)
           
 void setProperties(java.util.Map properties)
          Set configuration properties of the component
 void skippedEntity(java.lang.String name)
           
 void startDocument()
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
 
Methods inherited from class org.kabeja.processing.AbstractConfigurable
getProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kabeja.processing.Configurable
getProperties
 

Field Detail

DEFAULT_ENCODING

public static final java.lang.String DEFAULT_ENCODING
See Also:
Constant Field Values

SUFFIX

public static final java.lang.String SUFFIX
See Also:
Constant Field Values

SUFFIX_GZIP

public static final java.lang.String SUFFIX_GZIP
See Also:
Constant Field Values

MIMETYPE

public static final java.lang.String MIMETYPE
See Also:
Constant Field Values

PROPERTY_ENCODING

public static final java.lang.String PROPERTY_ENCODING
See Also:
Constant Field Values

PROPERTY_GZIP

public static final java.lang.String PROPERTY_GZIP
See Also:
Constant Field Values

rootxmlns

protected java.util.HashMap rootxmlns

gzip

protected boolean gzip
Constructor Detail

SAXPrettyOutputter

public SAXPrettyOutputter(java.io.OutputStream output,
                          java.lang.String encoding)

SAXPrettyOutputter

public SAXPrettyOutputter(java.io.OutputStream out)

SAXPrettyOutputter

public SAXPrettyOutputter()
Method Detail

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

encodeXML

public static java.lang.String encodeXML(java.lang.String text)

setDTD

public void setDTD(java.lang.String dtd)

queryXMLNS

protected void queryXMLNS(org.xml.sax.Attributes atts)

getMimeType

public java.lang.String getMimeType()
Specified by:
getMimeType in interface SAXSerializer

getSuffix

public java.lang.String getSuffix()
Specified by:
getSuffix in interface SAXSerializer

setOutput

public void setOutput(java.io.OutputStream out)
Specified by:
setOutput in interface SAXSerializer

setProperties

public void setProperties(java.util.Map properties)
Description copied from interface: Configurable
Set configuration properties of the component

Specified by:
setProperties in interface Configurable
Overrides:
setProperties in class AbstractConfigurable