## org.apache.xml.serializer
Class ToXMLSAXHandler

    java.lang.Object
      |
      +--org.apache.xml.serializer.SerializerBase
            |
            +--org.apache.xml.serializer.ToSAXHandler
                  |
                  +--org.apache.xml.serializer.ToXMLSAXHandler

public final class ToXMLSAXHandler
extends ToSAXHandler

This class receives notification of SAX-like events, and with gathered information over these calls it will invoke the equivalent SAX methods on a handler, the ultimate xsl:output method is known to be "xml". This class is not a public API.

Usage:
  **For internal use only**

Fields inherited from class org.apache.xml.serializer.SerializerBase
`PKG_NAME, PKG_PATH`

Constructor Summary
`ToXMLSAXHandler()`
`ToXMLSAXHandler(ContentHandler handler, LexicalHandler lex, java.lang.String encoding)`
`ToXMLSAXHandler(ContentHandler handler, java.lang.String encoding)`

Method Summary
`void` `addAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value, boolean XSLAttribute)` Adds the given attribute to the set of attributes, and also makes sure that the needed prefix/uri mapping is declared, but only if there is a currently open element.
`void` `attributeDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4)`
`void` `characters(char[] ch, int off, int len)`
`void` `characters(java.lang.String chars)`
`void` `closeCDATA()` Closes ane open cdata tag, and unlike the this.endCDATA() method (from the LexicalHandler) interface, this "internal" method will send the endCDATA() call to the wrapped handler.
`void` `comment(char[] arg0, int arg1, int arg2)`
`void` `elementDecl(java.lang.String arg0, java.lang.String arg1)`
`void` `endCDATA()`
`void` `endDocument()` Receives notification of the end of the document.
`void` `endDTD()`
`void` `endElement(java.lang.String elemName)`
`void` `endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)`
`void` `endPrefixMapping(java.lang.String prefix)`
`void` `externalEntityDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)`
`java.util.Properties` `getOutputFormat()`
`java.io.OutputStream` `getOutputStream()`
`java.io.Writer` `getWriter()`
`void` `ignorableWhitespace(char[] arg0, int arg1, int arg2)`
`void` `indent(int n)` Do nothing for SAX.
`void` `internalEntityDecl(java.lang.String arg0, java.lang.String arg1)`
`void` `namespaceAfterStartElement(java.lang.String prefix, java.lang.String uri)` Send a namespace declaration in the output document.
`void` `processingInstruction(java.lang.String target, java.lang.String data)`
`boolean` `reset()` Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons).
`void` `serialize(Node node)`
`void` `setDocumentLocator(Locator arg0)`
`boolean` `setEscaping(boolean escape)`
`void` `setOutputFormat(java.util.Properties format)`
`void` `setOutputStream(java.io.OutputStream output)`
`void` `setWriter(java.io.Writer writer)`
`void` `skippedEntity(java.lang.String arg0)`
`void` `startCDATA()`
`void` `startElement(java.lang.String elementName)`
`void` `startElement(java.lang.String elementNamespaceURI, java.lang.String elementLocalName, java.lang.String elementName)` Start an element in the output document.
`void` `startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String name, Attributes atts)`
`void` `startEntity(java.lang.String arg0)`
`void` `startPrefixMapping(java.lang.String prefix, java.lang.String uri)`
`boolean` `startPrefixMapping(java.lang.String prefix, java.lang.String uri, boolean shouldFlush)` Remember the prefix/uri mapping at the current nested element depth.

Methods inherited from class org.apache.xml.serializer.ToSAXHandler
`addUniqueAttribute, characters, comment, error, fatalError, flushPending, setCdataSectionElements, setContentHandler, setLexHandler, setShouldOutputNSAttr, setTransformState, startDTD, warning`

Methods inherited from class org.apache.xml.serializer.SerializerBase

`addAttribute, addAttribute, addAttributeAlways, addAttributes, addXSLAttribute, asContentHandler, asDOM3Serializer, asDOMSerializer, close, documentIsEmpty, endEntity, entityReference, fireEndEntity, getDoctypePublic, getDoctypeSystem, getEncoding, getIndent, getIndentAmount, getMediaType, getNamespaceMappings, getNamespaceURI, getNamespaceURIFromPrefix, getOmitXMLDeclaration, getOutputProperty, getOutputPropertyDefault, getOutputPropertyNonDefault, getPrefix, getStandalone, getTransformer, getVersion, notationDecl, setDoctype, setDoctypePublic, setDoctypeSystem, setDTDEntityExpansion, setEncoding, setIndent, setIndentAmount, setMediaType, setNamespaceMappings, setOmitXMLDeclaration, setOutputProperty, setOutputPropertyDefault, setSourceLocator, setStandalone, setTransformer, setVersion, startDocument, unparsedEntityDecl`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ToXMLSAXHandler

    public ToXMLSAXHandler()

### ToXMLSAXHandler

    public ToXMLSAXHandler(ContentHandler handler,
                           java.lang.String encoding)

### ToXMLSAXHandler

    public ToXMLSAXHandler(ContentHandler handler,
                           LexicalHandler lex,
                           java.lang.String encoding)

Method Detail

### getOutputFormat

    public java.util.Properties getOutputFormat()

  See Also:
    `Serializer.getOutputFormat()`

### getOutputStream

    public java.io.OutputStream getOutputStream()

  See Also:
    `Serializer.getOutputStream()`

### getWriter

    public java.io.Writer getWriter()

  See Also:
    `Serializer.getWriter()`

### indent

    public void indent(int n)
                throws SAXException

  Do nothing for SAX.

### serialize

    public void serialize(Node node)
                   throws java.io.IOException

  See Also:
    `DOMSerializer.serialize(Node)`

### setEscaping

    public boolean setEscaping(boolean escape)
                        throws SAXException

  See Also:
    `SerializationHandler.setEscaping(boolean)`

### setOutputFormat

    public void setOutputFormat(java.util.Properties format)

  See Also:
    `Serializer.setOutputFormat(Properties)`

### setOutputStream

    public void setOutputStream(java.io.OutputStream output)

  See Also:
    `Serializer.setOutputStream(OutputStream)`

### setWriter

    public void setWriter(java.io.Writer writer)

  See Also:
    `Serializer.setWriter(Writer)`

### attributeDecl

    public void attributeDecl(java.lang.String arg0,
                              java.lang.String arg1,
                              java.lang.String arg2,
                              java.lang.String arg3,
                              java.lang.String arg4)
                       throws SAXException

  See Also:
    `DeclHandler.attributeDecl(String, String, String, String, String)`

### elementDecl

    public void elementDecl(java.lang.String arg0,
                            java.lang.String arg1)
                     throws SAXException

  See Also:
    `DeclHandler.elementDecl(String, String)`

### externalEntityDecl

    public void externalEntityDecl(java.lang.String arg0,
                                   java.lang.String arg1,
                                   java.lang.String arg2)
                            throws SAXException

  See Also:
    `DeclHandler.externalEntityDecl(String, String, String)`

### internalEntityDecl

    public void internalEntityDecl(java.lang.String arg0,
                                   java.lang.String arg1)
                            throws SAXException

  See Also:
    `DeclHandler.internalEntityDecl(String, String)`

### endDocument

    public void endDocument()
                     throws SAXException

  Receives notification of the end of the document.
  See Also:
    `ContentHandler.endDocument()`

### closeCDATA

    public void closeCDATA()
                    throws SAXException

  Closes ane open cdata tag, and unlike the this.endCDATA() method (from the LexicalHandler) interface, this "internal" method will send the endCDATA() call to the wrapped handler.

### endElement

    public void endElement(java.lang.String namespaceURI,
                           java.lang.String localName,
                           java.lang.String qName)
                    throws SAXException

  See Also:
    `ContentHandler.endElement(String, String, String)`

### endPrefixMapping

    public void endPrefixMapping(java.lang.String prefix)
                          throws SAXException

  See Also:
    `ContentHandler.endPrefixMapping(String)`

### ignorableWhitespace

    public void ignorableWhitespace(char[] arg0,
                                    int arg1,
                                    int arg2)
                             throws SAXException

  See Also:
    `ContentHandler.ignorableWhitespace(char[], int, int)`

### setDocumentLocator

    public void setDocumentLocator(Locator arg0)

  Overrides:
    setDocumentLocator in class SerializerBase
  See Also:
    `ContentHandler.setDocumentLocator(Locator)`

### skippedEntity

    public void skippedEntity(java.lang.String arg0)
                       throws SAXException

  See Also:
    `ContentHandler.skippedEntity(String)`

### startPrefixMapping

    public void startPrefixMapping(java.lang.String prefix,
                                   java.lang.String uri)
                            throws SAXException

  Parameters:
    `prefix` - The prefix that maps to the URI
    `uri` - The URI for the namespace
  See Also:
    `ContentHandler.startPrefixMapping(String, String)`

### startPrefixMapping

    public boolean startPrefixMapping(java.lang.String prefix,
                                      java.lang.String uri,
                                      boolean shouldFlush)
                               throws SAXException

  Remember the prefix/uri mapping at the current nested element depth.
  Parameters:
    `prefix` - The prefix that maps to the URI
    `uri` - The URI for the namespace
    `shouldFlush` - a flag indicating if the mapping applies to the current element or an up coming child (not used).
  See Also:
    `ContentHandler.startPrefixMapping(String, String)`

### comment

    public void comment(char[] arg0,
                        int arg1,
                        int arg2)
                 throws SAXException

  See Also:
    `LexicalHandler.comment(char[], int, int)`

### endCDATA

    public void endCDATA()
                  throws SAXException

  See Also:
    `LexicalHandler.endCDATA()`

### endDTD

    public void endDTD()
                throws SAXException

  See Also:
    `LexicalHandler.endDTD()`

### startEntity

    public void startEntity(java.lang.String arg0)
                     throws SAXException

  See Also:
    `LexicalHandler.startEntity(String)`

### characters

    public void characters(java.lang.String chars)
                    throws SAXException

  Overrides:
    characters in class ToSAXHandler
  See Also:
    `ExtendedContentHandler.characters(String)`

### startElement

    public void startElement(java.lang.String elementNamespaceURI,
                             java.lang.String elementLocalName,
                             java.lang.String elementName)
                      throws SAXException

  Start an element in the output document. This might be an XML element (<elem>data</elem> type) or a CDATA section.
  Overrides:
    startElement in class ToSAXHandler

### startElement

    public void startElement(java.lang.String elementName)
                      throws SAXException

  Overrides:
    startElement in class ToSAXHandler

### characters

    public void characters(char[] ch,
                           int off,
                           int len)
                    throws SAXException

### endElement

    public void endElement(java.lang.String elemName)
                    throws SAXException

  See Also:
    `ExtendedContentHandler.endElement(String)`

### namespaceAfterStartElement

    public void namespaceAfterStartElement(java.lang.String prefix,
                                           java.lang.String uri)
                                    throws SAXException

  Send a namespace declaration in the output document. The namespace declaration will not be include if the namespace is already in scope with the same prefix.
  Overrides:
    namespaceAfterStartElement in class SerializerBase

### processingInstruction

    public void processingInstruction(java.lang.String target,
                                      java.lang.String data)
                               throws SAXException

  Overrides:
    processingInstruction in class ToSAXHandler
  See Also:
    Send a processing instruction to the output document

### startCDATA

    public void startCDATA()
                    throws SAXException

### startElement

    public void startElement(java.lang.String namespaceURI,
                             java.lang.String localName,
                             java.lang.String name,
                             Attributes atts)
                      throws SAXException

  Overrides:
    startElement in class ToSAXHandler
  See Also:
    `ContentHandler.startElement(String, String, String, Attributes)`

### addAttribute

    public void addAttribute(java.lang.String uri,
                             java.lang.String localName,
                             java.lang.String rawName,
                             java.lang.String type,
                             java.lang.String value,
                             boolean XSLAttribute)
                      throws SAXException

  Adds the given attribute to the set of attributes, and also makes sure that the needed prefix/uri mapping is declared, but only if there is a currently open element.
  Parameters:
    `uri` - the URI of the attribute
    `localName` - the local name of the attribute
    `rawName` - the qualified name of the attribute
    `type` - the type of the attribute (probably CDATA)
    `value` - the value of the attribute
    `XSLAttribute` - true if this attribute is coming from an xsl:attribute element
  Overrides:
    addAttribute in class SerializerBase
  See Also:
    `ExtendedContentHandler.addAttribute(String, String, String, String, String)`

### reset

    public boolean reset()

  Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons).
  Returns:
    true if the class was successfuly reset.
  Overrides:
    reset in class ToSAXHandler
  See Also:
    `Serializer.reset()`

Copyright © 2006 Apache XML Project. All Rights Reserved.