## org.apache.xml.serializer
Class SerializerBase

    java.lang.Object
      org.apache.xml.serializer.SerializerBase

All Implemented Interfaces:
  DOMSerializer, SerializationHandler, Serializer, org.xml.sax.DTDHandler, org.xml.sax.ErrorHandler, org.xml.sax.ext.DeclHandler

Direct Known Subclasses:
  ToSAXHandler, ToStream, ToUnknownStream

    public abstract class SerializerBase

extends java.lang.Object
implements SerializationHandler

This class acts as a base class for the XML "serializers" and the stream serializers. It contains a number of common fields and methods.

Usage:
  **For internal use only**

Field Summary
`static java.lang.String` `CDATA_CONTINUE` To insert ]]> in a CDATA section by ending the last CDATA section with ]] and starting the next CDATA section with >
`static java.lang.String` `CDATA_DELIMITER_CLOSE` The constant "]]>"
`static java.lang.String` `CDATA_DELIMITER_OPEN`
`static java.lang.String` `DEFAULT_SAX_SERIALIZER`
`static java.lang.String` `EMPTYSTRING`
`static java.lang.String` `ENTITY_AMP`
`static java.lang.String` `ENTITY_CRLF`
`static java.lang.String` `ENTITY_GT`
`static java.lang.String` `ENTITY_LT`
`static java.lang.String` `ENTITY_QUOT`
`static int` `HTML_ATTREMPTY`
`static int` `HTML_ATTRURL`
`static int` `NO_BAD_CHARS`
`static java.lang.String` `XML_PREFIX`
`static java.lang.String` `XMLNS_PREFIX`
`static java.lang.String` `XMLNS_URI`
`static java.lang.String` `XMLVERSION10`
`static java.lang.String` `XMLVERSION11` Define the XML version.

Constructor Summary
`SerializerBase()`

Method Summary
`void` `addAttribute(java.lang.String name, java.lang.String value)` Adds the given attribute to the set of collected attributes, but only if there is a currently open element.
`void` `addAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value)` This method adds an attribute the the current element, but should not be used for an xsl:attribute child.
`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 collected attributes , but only if there is a currently open element.
`boolean` `addAttributeAlways(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, even if there is no currently open element.
`void` `addAttributes(org.xml.sax.Attributes atts)` Add the given attributes to the currently collected ones.
`void` `addUniqueAttribute(java.lang.String qName, java.lang.String value, int flags)` Add a unique attribute to the current element.
`void` `addXSLAttribute(java.lang.String name, java.lang.String value, java.lang.String uri)` Adds the given xsl:attribute to the set of collected attributes, but only if there is a currently open element.
`org.xml.sax.ContentHandler` `asContentHandler()` Return a `ContentHandler` interface into this serializer.
`DOMSerializer` `asDOMSerializer()` Return a `DOMSerializer` interface into this serializer.
`void` `characters(org.w3c.dom.Node node)` This method gets the nodes value as a String and uses that String as if it were an input character notification.
`void` `characters(java.lang.String chars)` This method is used to notify of a character event, but passing the data as a character String rather than the standard character array.
`void` `close()` Flush and close the underlying java.io.Writer.
`void` `comment(java.lang.String data)` Receive notification of a comment.
`void` `endElement(java.lang.String elemName)` This method is used to notify that an element has ended.
`void` `endEntity(java.lang.String name)` Report the end of an entity.
`void` `entityReference(java.lang.String name)` Entity reference event.
`void` `error(org.xml.sax.SAXParseException exc)`
`void` `fatalError(org.xml.sax.SAXParseException exc)`
`void` `fireEndEntity(java.lang.String name)` To fire off end entity trace event
`java.lang.String` `getDoctypePublic()` Returns the previously set value of the value to be used as the public identifier in the document type declaration (DTD).
`java.lang.String` `getDoctypeSystem()` Returns the previously set value of the value to be used as the system identifier in the document type declaration (DTD).
`java.lang.String` `getEncoding()` Returns the character encoding to be used in the output document.
`boolean` `getIndent()`
`int` `getIndentAmount()`
`java.lang.String` `getMediaType()` Gets the mediatype the media-type or MIME type associated with the output document.
`NamespaceMappings` `getNamespaceMappings()` Some users of the serializer may need the current namespace mappings
`java.lang.String` `getNamespaceURI(java.lang.String qname, boolean isElement)` Returns the URI of an element or attribute.
`java.lang.String` `getNamespaceURIFromPrefix(java.lang.String prefix)` Returns the URI of prefix (if any)
`boolean` `getOmitXMLDeclaration()`
`java.lang.String` `getPrefix(java.lang.String namespaceURI)` Returns the prefix currently pointing to the given URI (if any).
`java.lang.String` `getStandalone()` Gets the XSL standalone attribute
`javax.xml.transform.Transformer` `getTransformer()` Gets the transformer associated with this serializer
`java.lang.String` `getVersion()` Gets the version of the output format.
`void` `namespaceAfterStartElement(java.lang.String uri, java.lang.String prefix)` This method is used when a prefix/uri namespace mapping is indicated after the element was started with a startElement() and before and endElement().
`void` `notationDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)`
`boolean` `reset()` This method resets the serializer.
`void` `setCdataSectionElements(java.util.Vector URI_and_localNames)` Sets the value coming from the xsl:output cdata-section-elements stylesheet property.
`void` `setDoctype(java.lang.String doctypeSystem, java.lang.String doctypePublic)` Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties
`void` `setDoctypePublic(java.lang.String doctypePublic)` Set the value coming from the xsl:output doctype-public stylesheet attribute.
`void` `setDoctypeSystem(java.lang.String doctypeSystem)` Set the value coming from the xsl:output doctype-system stylesheet attribute.
`void` `setDocumentLocator(org.xml.sax.Locator locator)` Receive an object for locating the origin of SAX document events.
`void` `setDTDEntityExpansion(boolean expand)` If set to false the serializer does not expand DTD entities, but leaves them as is, the default value is true.
`void` `setEncoding(java.lang.String m_encoding)` Sets the character encoding coming from the xsl:output encoding stylesheet attribute.
`void` `setIndent(boolean doIndent)` Sets the value coming from the xsl:output indent stylesheet attribute.
`void` `setIndentAmount(int m_indentAmount)` Sets the indentation amount.
`void` `setMediaType(java.lang.String mediaType)` Sets the value coming from the xsl:output media-type stylesheet attribute.
`void` `setNamespaceMappings(NamespaceMappings mappings)` Used only by TransformerSnapshotImpl to restore the serialization to a previous state.
`void` `setOmitXMLDeclaration(boolean b)` Sets the value coming from the xsl:output omit-xml-declaration stylesheet attribute
`void` `setSourceLocator(javax.xml.transform.SourceLocator locator)` This method is used to set the source locator, which might be used to generated an error message.
`void` `setStandalone(java.lang.String standalone)` Sets the value coming from the xsl:output standalone stylesheet attribute.
`void` `setTransformer(javax.xml.transform.Transformer t)` Sets the transformer associated with this serializer
`void` `setVersion(java.lang.String version)` Sets the value coming from the xsl:output version attribute.
`void` `startDocument()` Receive notification of the beginning of a document.
`void` `startElement(java.lang.String qName)` This method is used to notify of the start of an element
`void` `startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)` This method is used to notify that an element is starting.
`boolean` `startPrefixMapping(java.lang.String prefix, java.lang.String uri, boolean shouldFlush)` This method is used to notify that a prefix maping is to start, which can be for the current element, or for the one to come.
`void` `unparsedEntityDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)`
`void` `warning(org.xml.sax.SAXParseException exc)`

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

Methods inherited from interface org.apache.xml.serializer.SerializationHandler
`flushPending, serialize, setContentHandler, setEscaping`

Methods inherited from interface org.xml.sax.ContentHandler
`characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, skippedEntity, startElement, startPrefixMapping`

Methods inherited from interface org.xml.sax.ext.LexicalHandler
`comment, endCDATA, endDTD, startCDATA, startDTD, startEntity`

Methods inherited from interface org.xml.sax.ext.DeclHandler
`attributeDecl, elementDecl, externalEntityDecl, internalEntityDecl`

Methods inherited from interface org.apache.xml.serializer.Serializer
`getOutputFormat, getOutputStream, getWriter, setOutputFormat, setOutputStream, setWriter`

Field Detail

### NO_BAD_CHARS

    public static final int NO_BAD_CHARS

See Also:
  Constant Field Values

### HTML_ATTREMPTY

    public static final int HTML_ATTREMPTY

See Also:
  Constant Field Values

### HTML_ATTRURL

    public static final int HTML_ATTRURL

See Also:
  Constant Field Values

### CDATA_CONTINUE

    public static final java.lang.String CDATA_CONTINUE

  To insert ]]> in a CDATA section by ending the last CDATA section with ]] and starting the next CDATA section with >

  See Also:
    Constant Field Values

### CDATA_DELIMITER_CLOSE

    public static final java.lang.String CDATA_DELIMITER_CLOSE

  The constant "]]>"

  See Also:
    Constant Field Values

### CDATA_DELIMITER_OPEN

    public static final java.lang.String CDATA_DELIMITER_OPEN

See Also:
  Constant Field Values

### EMPTYSTRING

    public static final java.lang.String EMPTYSTRING

See Also:
  Constant Field Values

### ENTITY_AMP

    public static final java.lang.String ENTITY_AMP

See Also:
  Constant Field Values

### ENTITY_CRLF

    public static final java.lang.String ENTITY_CRLF

See Also:
  Constant Field Values

### ENTITY_GT

    public static final java.lang.String ENTITY_GT

See Also:
  Constant Field Values

### ENTITY_LT

    public static final java.lang.String ENTITY_LT

See Also:
  Constant Field Values

### ENTITY_QUOT

    public static final java.lang.String ENTITY_QUOT

See Also:
  Constant Field Values

### XML_PREFIX

    public static final java.lang.String XML_PREFIX

See Also:
  Constant Field Values

### XMLNS_PREFIX

    public static final java.lang.String XMLNS_PREFIX

See Also:
  Constant Field Values

### XMLNS_URI

    public static final java.lang.String XMLNS_URI

See Also:
  Constant Field Values

### DEFAULT_SAX_SERIALIZER

    public static final java.lang.String DEFAULT_SAX_SERIALIZER

See Also:
  Constant Field Values

### XMLVERSION11

    public static final java.lang.String XMLVERSION11

  Define the XML version.

  See Also:
    Constant Field Values

### XMLVERSION10

    public static final java.lang.String XMLVERSION10

See Also:
  Constant Field Values

Constructor Detail

### SerializerBase

    public SerializerBase()

Method Detail

### comment

    public void comment(java.lang.String data)
                 throws org.xml.sax.SAXException

  Receive notification of a comment.

  Parameters:
    `data` - the comment, but unlike the SAX comment() method this method takes a String rather than a character array.
  Throws:
    `org.xml.sax.SAXException`
  See Also:
    `ExtendedLexicalHandler.comment(String)`

### setDocumentLocator

    public void setDocumentLocator(org.xml.sax.Locator locator)

  Receive an object for locating the origin of SAX document events.

  Parameters:
    `locator` - An object that can return the location of any SAX document event. Receive an object for locating the origin of SAX document events.

    SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface.

    The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.

    Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.

### 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 org.xml.sax.SAXException

  Adds the given attribute to the set of collected attributes , but only if there is a currently open element. An element is currently open if a startElement() notification has occured but the start of the element has not yet been written to the output. In the stream case this means that we have not yet been forced to close the elements opening tag by another notification, such as a character notification.

  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:attriute element
  Throws:
    `org.xml.sax.SAXException`
  See Also:
    `ExtendedContentHandler.addAttribute(String, String, String, String, String)`

### addAttributeAlways

    public boolean addAttributeAlways(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, even if there is no currently open element. This is useful if a SAX startPrefixMapping() should need to add an attribute before the element name is seen.

  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
  Returns:
    true if the attribute was added, false if an existing value was replaced.

### addAttribute

    public void addAttribute(java.lang.String name,
                             java.lang.String value)

  Adds the given attribute to the set of collected attributes, but only if there is a currently open element.

  Parameters:
    `name` - the attribute's qualified name
    `value` - the value of the attribute

### addXSLAttribute

    public void addXSLAttribute(java.lang.String name,
                                java.lang.String value,
                                java.lang.String uri)

  Adds the given xsl:attribute to the set of collected attributes, but only if there is a currently open element.

  Parameters:
    `name` - the attribute's qualified name (prefix:localName)
    `value` - the value of the attribute
    `uri` - the URI that the prefix of the name points to

### addAttributes

    public void addAttributes(org.xml.sax.Attributes atts)
                       throws org.xml.sax.SAXException

  Add the given attributes to the currently collected ones. These attributes are always added, regardless of whether on not an element is currently open.

  Parameters:
    `atts` - List of attributes to add to this list
  Throws:
    `org.xml.sax.SAXException`

### asContentHandler

    public org.xml.sax.ContentHandler asContentHandler()
                                                throws java.io.IOException

  Return a `ContentHandler` interface into this serializer. If the serializer does not support the `ContentHandler` interface, it should return null.

  Specified by:
    `asContentHandler` in interface `Serializer`
  Returns:
    A `ContentHandler` interface into this serializer, or null if the serializer is not SAX 2 capable
  Throws:
    `java.io.IOException` - An I/O exception occured

### endEntity

    public void endEntity(java.lang.String name)
                   throws org.xml.sax.SAXException

  Report the end of an entity.

  Parameters:
    `name` - The name of the entity that is ending.
  Throws:
    `org.xml.sax.SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.startEntity(java.lang.String)`

### close

    public void close()

  Flush and close the underlying java.io.Writer. This method applies to ToStream serializers, not ToSAXHandler serializers.

  Specified by:
    `close` in interface `SerializationHandler`
  See Also:
    `ToStream`

### getEncoding

    public java.lang.String getEncoding()

  Returns the character encoding to be used in the output document.

  Returns:
    the character encoding to be used in the output document.

### setEncoding

    public void setEncoding(java.lang.String m_encoding)

  Sets the character encoding coming from the xsl:output encoding stylesheet attribute.

  Parameters:
    `m_encoding` - the character encoding

### setOmitXMLDeclaration

    public void setOmitXMLDeclaration(boolean b)

  Sets the value coming from the xsl:output omit-xml-declaration stylesheet attribute

  Parameters:
    `b` - true if the XML declaration is to be omitted from the output document.

### getOmitXMLDeclaration

    public boolean getOmitXMLDeclaration()

  Returns:
    true if the XML declaration is to be omitted from the output document.

### getDoctypePublic

    public java.lang.String getDoctypePublic()

  Returns the previously set value of the value to be used as the public identifier in the document type declaration (DTD).

  Returns:
    the public identifier to be used in the DOCTYPE declaration in the output document.

### setDoctypePublic

    public void setDoctypePublic(java.lang.String doctypePublic)

  Set the value coming from the xsl:output doctype-public stylesheet attribute.

  Parameters:
    `doctypePublic` - the public identifier to be used in the DOCTYPE declaration in the output document.

### getDoctypeSystem

    public java.lang.String getDoctypeSystem()

  Returns the previously set value of the value to be used as the system identifier in the document type declaration (DTD).

  Returns:
    the system identifier to be used in the DOCTYPE declaration in the output document.

### setDoctypeSystem

    public void setDoctypeSystem(java.lang.String doctypeSystem)

  Set the value coming from the xsl:output doctype-system stylesheet attribute.

  Parameters:
    `doctypeSystem` - the system identifier to be used in the DOCTYPE declaration in the output document.

### setDoctype

    public void setDoctype(java.lang.String doctypeSystem,
                           java.lang.String doctypePublic)

  Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties

  Parameters:
    `doctypeSystem` - the system identifier to be used in the DOCTYPE declaration in the output document.
    `doctypePublic` - the public identifier to be used in the DOCTYPE declaration in the output document.

### setStandalone

    public void setStandalone(java.lang.String standalone)

  Sets the value coming from the xsl:output standalone stylesheet attribute.

  Parameters:
    `standalone` - a value of "yes" indicates that the `standalone` delaration is to be included in the output document. This method remembers if the value was explicitly set using this method, verses if the value is the default value.

### getStandalone

    public java.lang.String getStandalone()

  Gets the XSL standalone attribute

  Returns:
    a value of "yes" if the `standalone` delaration is to be included in the output document.
  See Also:
    `XSLOutputAttributes.getStandalone()`

### getIndent

    public boolean getIndent()

  Returns:
    true if the output document should be indented to visually indicate its structure.

### getMediaType

    public java.lang.String getMediaType()

  Gets the mediatype the media-type or MIME type associated with the output document.

  Returns:
    the mediatype the media-type or MIME type associated with the output document.

### getVersion

    public java.lang.String getVersion()

  Gets the version of the output format.

  Returns:
    the version of the output format.

### setVersion

    public void setVersion(java.lang.String version)

  Sets the value coming from the xsl:output version attribute.

  Parameters:
    `version` - the version of the output format.
  See Also:
    `XSLOutputAttributes.setVersion(String)`

### setMediaType

    public void setMediaType(java.lang.String mediaType)

  Sets the value coming from the xsl:output media-type stylesheet attribute.

  Parameters:
    `mediaType` - the non-null media-type or MIME type associated with the output document.
  See Also:
    `OutputKeys.MEDIA_TYPE`, `XSLOutputAttributes.setMediaType(String)`

### getIndentAmount

    public int getIndentAmount()

  Returns:
    the number of spaces to indent for each indentation level.

### setIndentAmount

    public void setIndentAmount(int m_indentAmount)

  Sets the indentation amount.

  Specified by:
    `setIndentAmount` in interface `SerializationHandler`
  Parameters:
    `m_indentAmount` - The m_indentAmount to set

### setIndent

    public void setIndent(boolean doIndent)

  Sets the value coming from the xsl:output indent stylesheet attribute.

  Parameters:
    `doIndent` - true if the output document should be indented to visually indicate its structure.
  See Also:
    `XSLOutputAttributes.setIndent(boolean)`

### namespaceAfterStartElement

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

  This method is used when a prefix/uri namespace mapping is indicated after the element was started with a startElement() and before and endElement(). startPrefixMapping(prefix,uri) would be used before the startElement() call.

  Parameters:
    `uri` - the URI of the namespace
    `prefix` - the prefix associated with the given URI.
  Throws:
    `org.xml.sax.SAXException`
  See Also:
    `ExtendedContentHandler.namespaceAfterStartElement(String, String)`

### asDOMSerializer

    public DOMSerializer asDOMSerializer()
                                  throws java.io.IOException

  Return a `DOMSerializer` interface into this serializer. If the serializer does not support the `DOMSerializer` interface, it should return null.

  Specified by:
    `asDOMSerializer` in interface `Serializer`
  Returns:
    A `DOMSerializer` interface into this serializer, or null if the serializer is not DOM capable
  Throws:
    `java.io.IOException` - An I/O exception occured
  See Also:
    `Serializer.asDOMSerializer()`

### getNamespaceMappings

    public NamespaceMappings getNamespaceMappings()

  Some users of the serializer may need the current namespace mappings

  Returns:
    the current namespace mappings (prefix/uri)
  See Also:
    `ExtendedContentHandler.getNamespaceMappings()`

### getPrefix

    public java.lang.String getPrefix(java.lang.String namespaceURI)

  Returns the prefix currently pointing to the given URI (if any).

  Parameters:
    `namespaceURI` - the uri of the namespace in question
  Returns:
    a prefix pointing to the given URI (if any).
  See Also:
    `ExtendedContentHandler.getPrefix(String)`

### getNamespaceURI

    public java.lang.String getNamespaceURI(java.lang.String qname,
                                            boolean isElement)

  Returns the URI of an element or attribute. Note that default namespaces do not apply directly to attributes.

  Parameters:
    `qname` - a qualified name
    `isElement` - true if the qualified name is the name of an element.
  Returns:
    returns the namespace URI associated with the qualified name.

### getNamespaceURIFromPrefix

    public java.lang.String getNamespaceURIFromPrefix(java.lang.String prefix)

  Returns the URI of prefix (if any)

  Parameters:
    `prefix` - the prefix whose URI is searched for
  Returns:
    the namespace URI currently associated with the prefix, null if the prefix is undefined.

### entityReference

    public void entityReference(java.lang.String name)
                         throws org.xml.sax.SAXException

  Entity reference event.

  Parameters:
    `name` - Name of entity
  Throws:
    `org.xml.sax.SAXException`

### setTransformer

    public void setTransformer(javax.xml.transform.Transformer t)

  Sets the transformer associated with this serializer

  Specified by:
    `setTransformer` in interface `SerializationHandler`
  Parameters:
    `t` - the transformer associated with this serializer.
  See Also:
    `SerializationHandler.setTransformer(Transformer)`

### getTransformer

    public javax.xml.transform.Transformer getTransformer()

  Gets the transformer associated with this serializer

  Specified by:
    `getTransformer` in interface `SerializationHandler`
  Returns:
    returns the transformer associated with this serializer.
  See Also:
    `SerializationHandler.getTransformer()`

### characters

    public void characters(org.w3c.dom.Node node)
                    throws org.xml.sax.SAXException

  This method gets the nodes value as a String and uses that String as if it were an input character notification.

  Parameters:
    `node` - the Node to serialize
  Throws:
    `org.xml.sax.SAXException`

### error

    public void error(org.xml.sax.SAXParseException exc)
               throws org.xml.sax.SAXException

  Specified by:
    `error` in interface `org.xml.sax.ErrorHandler`
  Throws:
    `org.xml.sax.SAXException`
  See Also:
    `ErrorHandler.error(SAXParseException)`

### fatalError

    public void fatalError(org.xml.sax.SAXParseException exc)
                    throws org.xml.sax.SAXException

  Specified by:
    `fatalError` in interface `org.xml.sax.ErrorHandler`
  Throws:
    `org.xml.sax.SAXException`
  See Also:
    `ErrorHandler.fatalError(SAXParseException)`

### warning

    public void warning(org.xml.sax.SAXParseException exc)
                 throws org.xml.sax.SAXException

  Specified by:
    `warning` in interface `org.xml.sax.ErrorHandler`
  Throws:
    `org.xml.sax.SAXException`
  See Also:
    `ErrorHandler.warning(SAXParseException)`

### fireEndEntity

    public void fireEndEntity(java.lang.String name)
                       throws org.xml.sax.SAXException

  To fire off end entity trace event

  Parameters:
    `name` - Name of entity
  Throws:
    `org.xml.sax.SAXException`

### startDocument

    public void startDocument()
                       throws org.xml.sax.SAXException

  Receive notification of the beginning of a document. This method is never a self generated call, but only called externally.

  The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).

  Throws:
    `org.xml.sax.SAXException` - Any SAX exception, possibly wrapping another exception.
    `org.xml.sax.SAXException`

### setSourceLocator

    public void setSourceLocator(javax.xml.transform.SourceLocator locator)

  This method is used to set the source locator, which might be used to generated an error message.

  Parameters:
    `locator` - the source locator
  See Also:
    `ExtendedContentHandler.setSourceLocator(javax.xml.transform.SourceLocator)`

### setNamespaceMappings

    public void setNamespaceMappings(NamespaceMappings mappings)

  Used only by TransformerSnapshotImpl to restore the serialization to a previous state.

  Specified by:
    `setNamespaceMappings` in interface `SerializationHandler`
  Parameters:
    `mappings` - NamespaceMappings

### reset

    public boolean reset()

  Description copied from interface: `Serializer`
  This method resets the serializer. If this method returns true, the serializer may be used for subsequent serialization of new documents. It is possible to change the output format and output stream prior to serializing, or to reuse the existing output format and output stream or writer.

  Specified by:
    `reset` in interface `Serializer`
  Returns:
    True if serializer has been reset and can be reused

### addAttribute

    public void addAttribute(java.lang.String uri,
                             java.lang.String localName,
                             java.lang.String rawName,
                             java.lang.String type,
                             java.lang.String value)
                      throws org.xml.sax.SAXException

  This method adds an attribute the the current element, but should not be used for an xsl:attribute child.

  Parameters:
    `uri` - the namespace URI of the attribute name
    `localName` - the local name of the attribute (without prefix)
    `rawName` - the qualified name of the attribute
    `type` - the attribute type typically character data (CDATA)
    `value` - the value of the attribute
  Throws:
    `org.xml.sax.SAXException`
  See Also:
    `ExtendedContentHandler.addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)`

### notationDecl

    public void notationDecl(java.lang.String arg0,
                             java.lang.String arg1,
                             java.lang.String arg2)
                      throws org.xml.sax.SAXException

  Specified by:
    `notationDecl` in interface `org.xml.sax.DTDHandler`
  Throws:
    `org.xml.sax.SAXException`
  See Also:
    `DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)`

### unparsedEntityDecl

    public void unparsedEntityDecl(java.lang.String arg0,
                                   java.lang.String arg1,
                                   java.lang.String arg2,
                                   java.lang.String arg3)
                            throws org.xml.sax.SAXException

  Specified by:
    `unparsedEntityDecl` in interface `org.xml.sax.DTDHandler`
  Throws:
    `org.xml.sax.SAXException`
  See Also:
    `DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)`

### setDTDEntityExpansion

    public void setDTDEntityExpansion(boolean expand)

  If set to false the serializer does not expand DTD entities, but leaves them as is, the default value is true.

  Specified by:
    `setDTDEntityExpansion` in interface `SerializationHandler`
  Parameters:
    `expand` - true if DTD entities are to be expanded, false if they are to be left as DTD entity references.

### characters

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

  This method is used to notify of a character event, but passing the data as a character String rather than the standard character array.

  Parameters:
    `chars` - the character data
  Throws:
    `org.xml.sax.SAXException`

### endElement

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

  This method is used to notify that an element has ended. Unlike the standard SAX method

       endElement(namespaceURI,localName,qName)

  only the last parameter is passed. If needed the serializer can derive the localName from the qualified name and derive the namespaceURI from its implementation.

  Parameters:
    `elemName` - the fully qualified element name.
  Throws:
    `org.xml.sax.SAXException`

### startElement

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

  This method is used to notify that an element is starting. This method is just like the standard SAX method

       startElement(uri,localName,qname,atts)

  but without the attributes.

  Parameters:
    `uri` - the namespace URI of the element
    `localName` - the local name (without prefix) of the element
    `qName` - the qualified name of the element
  Throws:
    `org.xml.sax.SAXException`

### startElement

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

  This method is used to notify of the start of an element

  Parameters:
    `qName` - the fully qualified name of the element
  Throws:
    `org.xml.sax.SAXException`

### startPrefixMapping

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

  This method is used to notify that a prefix maping is to start, which can be for the current element, or for the one to come.

  Parameters:
    `prefix` - the prefix that maps to the given URI
    `uri` - the namespace URI of the given prefix
    `shouldFlush` - if true this call is like the SAX startPrefixMapping(prefix,uri) call and the mapping applies to the element to come. If false the mapping applies to the current element.
  Returns:
    boolean false if the prefix mapping was already in effect (in other words we are just re-declaring), true if this is a new, never before seen mapping for the element.
  Throws:
    `org.xml.sax.SAXException`

### addUniqueAttribute

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

  Add a unique attribute to the current element. The attribute is guaranteed to be unique here. The serializer can write it out immediately without saving it in a table first. The integer flag contains information about the attribute, which helps the serializer to decide whether a particular processing is needed.

  Parameters:
    `qName` - the fully qualified attribute name.
    `value` - the attribute value
    `flags` - a bitwise flag
  Throws:
    `org.xml.sax.SAXException`

### setCdataSectionElements

    public void setCdataSectionElements(java.util.Vector URI_and_localNames)

  Sets the value coming from the xsl:output cdata-section-elements stylesheet property. This sets the elements whose text elements are to be output as CDATA sections.

  Parameters:
    `URI_and_localNames` - pairs of namespace URI and local names that identify elements whose text elements are to be output as CDATA sections. The namespace of the local element must be the given URI to match. The qName is not given because the prefix does not matter, only the namespace URI to which that prefix would map matters, so the prefix itself is not relevant in specifying which elements have their text to be output as CDATA sections.

Copyright © 2005 Apache XML Project. All Rights Reserved.