## org.apache.xml.serializer
Class ToSAXHandler

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

Direct Known Subclasses:
  ToHTMLSAXHandler, ToTextSAXHandler, ToXMLSAXHandler

public abstract class ToSAXHandler
extends SerializerBase

This class is used to provide a base behavior to be inherited by other To...SAXHandler serializers. 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
`ToSAXHandler()`
`ToSAXHandler(ContentHandler hdlr, LexicalHandler lex, java.lang.String encoding)`
`ToSAXHandler(ContentHandler handler, java.lang.String encoding)`

Method Summary
`void` `addUniqueAttribute(java.lang.String qName, java.lang.String value, int flags)` Add a unique attribute
`void` `characters(Node node)` This method gets the node's value as a String and uses that String as if it were an input character notification.
`void` `characters(java.lang.String characters)` Receive notification of character data.
`void` `comment(java.lang.String comment)` Receive notification of a comment.
`void` `error(SAXParseException exc)`
`void` `fatalError(SAXParseException exc)`
`void` `flushPending()` This method flushes any pending events, which can be startDocument() closing the opening tag of an element, or closing an open CDATA section.
`void` `processingInstruction(java.lang.String target, java.lang.String data)` Do nothing as this is an abstract class.
`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` `setCdataSectionElements(java.util.Vector URI_and_localNames)` Does nothing.
`void` `setContentHandler(ContentHandler _saxHandler)` Sets the SAX ContentHandler.
`void` `setLexHandler(LexicalHandler _lexHandler)` Sets the LexicalHandler.
`void` `setShouldOutputNSAttr(boolean doOutputNSAttr)` Set whether or not namespace declarations (e.g.
`void` `setTransformState(TransformStateSetter ts)` Pass in a reference to a TransformState object, which can be used during SAX ContentHandler events to obtain information about he state of the transformation.
`void` `startDTD(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)` Do nothing.
`void` `startElement(java.lang.String qName)` An element starts, but attributes are not fully known yet.
`void` `startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)` Receives notification that an element starts, but attributes are not fully known yet.
`void` `startElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, Attributes arg3)` Receive notification of the beginning of an element, although this is a SAX method additional namespace or attribute information can occur before or after this call, that is associated with this element.
`void` `warning(SAXParseException exc)`

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

`addAttribute, 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, namespaceAfterStartElement, notationDecl, setDoctype, setDoctypePublic, setDoctypeSystem, setDocumentLocator, 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

### ToSAXHandler

    public ToSAXHandler()

### ToSAXHandler

    public ToSAXHandler(ContentHandler hdlr,
                        LexicalHandler lex,
                        java.lang.String encoding)

### ToSAXHandler

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

Method Detail

### startDTD

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

  Do nothing.
  See Also:
    `LexicalHandler.startDTD(String, String, String)`

### characters

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

  Receive notification of character data.
  Parameters:
    `characters` - The string of characters to process.
  Throws:
    SAXException -
  See Also:
    `ExtendedContentHandler.characters(String)`

### comment

    public void comment(java.lang.String comment)
                 throws SAXException

  Receive notification of a comment.
  Overrides:
    comment in class SerializerBase
  See Also:
    `ExtendedLexicalHandler.comment(String)`

### processingInstruction

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

  Do nothing as this is an abstract class. All subclasses will need to define their behavior if it is different.
  See Also:
    `ContentHandler.processingInstruction(String, String)`

### startElement

    public void startElement(java.lang.String arg0,
                             java.lang.String arg1,
                             java.lang.String arg2,
                             Attributes arg3)
                      throws SAXException

  Receive notification of the beginning of an element, although this is a SAX method additional namespace or attribute information can occur before or after this call, that is associated with this element.
  Throws:
    SAXException - Any SAX exception, possibly wrapping another exception.
    SAXException -
  See Also:
    `ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)`, `ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)`, `AttributeList`, `ContentHandler.startElement(String,String,String,Attributes)`

### setLexHandler

    public void setLexHandler(LexicalHandler _lexHandler)

  Sets the LexicalHandler.
  Parameters:
    `_lexHandler` - The LexicalHandler to set

### setContentHandler

    public void setContentHandler(ContentHandler _saxHandler)

  Sets the SAX ContentHandler.
  Parameters:
    `_saxHandler` - The ContentHandler to set

### setCdataSectionElements

    public void setCdataSectionElements(java.util.Vector URI_and_localNames)

  Does nothing. The setting of CDATA section elements has an impact on stream serializers.
  See Also:
    `XSLOutputAttributes.setCdataSectionElements(java.util.Vector)`

### setShouldOutputNSAttr

    public void setShouldOutputNSAttr(boolean doOutputNSAttr)

  Set whether or not namespace declarations (e.g. xmlns:foo) should appear as attributes of elements
  Parameters:
    `doOutputNSAttr` - whether or not namespace declarations should appear as attributes

### flushPending

    public void flushPending()
                      throws SAXException

  This method flushes any pending events, which can be startDocument() closing the opening tag of an element, or closing an open CDATA section.

### setTransformState

    public void setTransformState(TransformStateSetter ts)

  Pass in a reference to a TransformState object, which can be used during SAX ContentHandler events to obtain information about he state of the transformation. This method will be called before each startDocument event.
  Parameters:
    `ts` - A reference to a TransformState object

### startElement

    public void startElement(java.lang.String uri,
                             java.lang.String localName,
                             java.lang.String qName)
                      throws SAXException

  Receives notification that an element starts, but attributes are not fully known yet.
  Parameters:
    `uri` - the URI of the namespace of the element (optional)
    `localName` - the element name, but without prefix (optional)
    `qName` - the element name, with prefix, if any (required)
  See Also:
    `ExtendedContentHandler.startElement(String, String, String)`

### startElement

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

  An element starts, but attributes are not fully known yet.
  Parameters:
    `qName` - the element name, with prefix (if any).
  See Also:
    `ExtendedContentHandler.startElement(String)`

### characters

    public void characters(Node node)
                    throws SAXException

  This method gets the node's value as a String and uses that String as if it were an input character notification.
  Parameters:
    `node` - the Node to serialize
  Throws:
    SAXException -
  Overrides:
    characters in class SerializerBase

### fatalError

    public void fatalError(SAXParseException exc)
                    throws SAXException

  Overrides:
    fatalError in class SerializerBase
  See Also:
    `ErrorHandler.fatalError(SAXParseException)`

### error

    public void error(SAXParseException exc)
               throws SAXException

  Overrides:
    error in class SerializerBase
  See Also:
    `ErrorHandler.error(SAXParseException)`

### warning

    public void warning(SAXParseException exc)
                 throws SAXException

  Overrides:
    warning in class SerializerBase
  See Also:
    `ErrorHandler.warning(SAXParseException)`

### 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 SerializerBase
  See Also:
    `Serializer.reset()`

### addUniqueAttribute

    public void addUniqueAttribute(java.lang.String qName,
                                   java.lang.String value,
                                   int flags)
                            throws SAXException

  Add a unique attribute

Copyright © 2006 Apache XML Project. All Rights Reserved.