## org.apache.xml.serializer
Class ToUnknownStream

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

All Implemented Interfaces:
  ContentHandler, DeclHandler, DOM2DTM.CharacterNodeHandler, DOMSerializer, ErrorHandler, ExtendedContentHandler, ExtendedLexicalHandler, LexicalHandler, SerializationHandler, Serializer, SerializerConstants, XSLOutputAttributes

public class ToUnknownStream
extends SerializerBase

This class wraps another SerializationHandler. The wrapped object will either handler XML or HTML, which is not known until a little later when the first XML tag is seen. If the first tag is
then the wrapped object is an HTML handler, otherwise it is an XML handler. This class effectively caches the first few calls to it then passes them on to the wrapped handler (once it exists). After that subsequent calls a simply passed directly to the wrapped handler. The user of this class doesn't know if the output is ultimatley XML or HTML.

Field Summary

Fields inherited from interface org.apache.xml.serializer.ExtendedContentHandler
`HTML_ATTREMPTY, HTML_ATTRURL, NO_BAD_CHARS`

Fields inherited from interface org.apache.xml.serializer.SerializerConstants
`BEGCDATA, CDATA_CONTINUE, CDATA_DELIMITER_CLOSE, CDATA_DELIMITER_OPEN, CNTCDATA, DEFAULT_SAX_SERIALIZER, ENDCDATA, ENTITY_AMP, ENTITY_CRLF, ENTITY_GT, ENTITY_LT, ENTITY_QUOT, XML_PREFIX, XMLNS_PREFIX, XMLNS_URI`

Constructor Summary
`ToUnknownStream()` Default constructor.

Method Summary
`void` `addAttribute(java.lang.String rawName, java.lang.String value)` Adds an attribute to the currenly open tag
`void` `addAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value)` Adds an attribute to the currenly open tag
`void` `addAttributes(Attributes atts)` Add the given attributes to the currently collected ones.
`void` `addUniqueAttribute(java.lang.String rawName, java.lang.String value, int flags)` Adds a unique attribute to the currenly open tag
`ContentHandler` `asContentHandler()` Return a `ContentHandler` interface into this serializer.
`DOMSerializer` `asDOMSerializer()` Return a `DOMSerializer` interface into this serializer.
`void` `attributeDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4)` Pass the call on to the underlying handler
`void` `characters(char[] characters, int offset, int length)` Pass the call on to the underlying handler
`void` `characters(java.lang.String chars)` Converts the String to a character array and calls the SAX method characters(char[],int,int);
`void` `close()` Flush and close the underlying java.io.Writer.
`void` `comment(char[] ch, int start, int length)` Pass the call on to the underlying handler
`void` `comment(java.lang.String comment)` Pass the call on to the underlying handler
`void` `elementDecl(java.lang.String arg0, java.lang.String arg1)` Pass the call on to the underlying handler
`void` `endCDATA()` Pass the call on to the underlying handler
`void` `endDocument()` Pass the call on to the underlying handler
`void` `endDTD()` Pass the call on to the underlying handler
`void` `endElement(java.lang.String elementName)` Pass the call on to the underlying handler
`void` `endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)` Pass the call on to the underlying handler
`void` `endEntity(java.lang.String name)` Pass the call on to the underlying handler
`void` `endPrefixMapping(java.lang.String prefix)` Pass the call on to the underlying handler
`void` `entityReference(java.lang.String entityName)` Entity reference event.
`void` `externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)` Pass the call on to the underlying handler
`void` `flushPending()` Flush any pending events currently queued up in the serializer.
`java.lang.String` `getDoctypePublic()` Pass the call on to the underlying handler
`java.lang.String` `getDoctypeSystem()` Pass the call on to the underlying handler
`java.lang.String` `getEncoding()` Pass the call on to the underlying handler
`boolean` `getIndent()` Pass the call on to the underlying handler
`int` `getIndentAmount()` Pass the call on to the underlying handler
`java.lang.String` `getMediaType()` Pass the call on to the underlying handler
`NamespaceMappings` `getNamespaceMappings()` Get 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()` Pass the call on to the underlying handler
`java.util.Properties` `getOutputFormat()` Returns the output format properties for this serializer.
`java.io.OutputStream` `getOutputStream()` Get the output stream where the events will be serialized to.
`java.lang.String` `getPrefix(java.lang.String namespaceURI)` Returns the prefix currently pointing to the given URI (if any).
`java.lang.String` `getStandalone()` Pass the call on to the underlying handler
`Transformer` `getTransformer()` Gets the transformer associated with this serializer
`java.lang.String` `getVersion()` Pass the call on to the underlying handler
`java.io.Writer` `getWriter()` Get the character stream where the events will be serialized to.
`void` `ignorableWhitespace(char[] ch, int start, int length)` Pass the call on to the underlying handler
`void` `internalEntityDecl(java.lang.String arg0, java.lang.String arg1)` Pass the call on to the underlying handler
`void` `namespaceAfterStartElement(java.lang.String prefix, java.lang.String uri)` 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` `processingInstruction(java.lang.String target, java.lang.String data)` Pass the call on to the underlying handler
`boolean` `reset()` passes the call on to the underlying HTML or XML handler
`void` `serialize(Node node)` Converts the DOM node to output
`void` `setCdataSectionElements(java.util.Vector URI_and_localNames)` Sets the value coming from the xsl:output cdata-section-elements stylesheet property.
`void` `setContentHandler(ContentHandler ch)` Set the SAX Content handler that the serializer sends its output to.
`void` `setDoctype(java.lang.String system, java.lang.String pub)` Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties
`void` `setDoctypePublic(java.lang.String doctype)` Set the doctype in the underlying XML handler.
`void` `setDoctypeSystem(java.lang.String doctype)` Set the doctype in the underlying XML handler.
`void` `setDocumentLocator(Locator locator)` Pass the call on to the underlying handler
`void` `setEncoding(java.lang.String encoding)` Pass the call on to the underlying handler
`boolean` `setEscaping(boolean escape)` Turns special character escaping on/off.
`void` `setIndent(boolean indent)` Pass the call on to the underlying handler
`void` `setIndentAmount(int value)` Pass the call on to the underlying handler
`void` `setMediaType(java.lang.String mediaType)` Sets the value coming from the xsl:output media-type stylesheet attribute.
`void` `setOmitXMLDeclaration(boolean b)` Pass the call on to the underlying handler
`void` `setOutputFormat(java.util.Properties format)` Set the properties of the handler
`void` `setOutputStream(java.io.OutputStream output)` Sets the output stream to write to
`void` `setSourceLocator(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)` Pass the call on to the underlying handler
`void` `setTransformer(Transformer t)` Sets the transformer associated with this serializer
`void` `setVersion(java.lang.String version)` This method cannot be cached because default is different in HTML and XML (we need more than a boolean).
`void` `setWriter(java.io.Writer writer)` Sets the writer to write to
`void` `skippedEntity(java.lang.String name)` Pass the call on to the underlying handler
`void` `startCDATA()` Pass the call on to the underlying handler
`void` `startDocument()` Receive notification of the beginning of a document.
`void` `startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)` Pass the call on to the underlying handler
`void` `startElement(java.lang.String qName)` This method is used to notify of the start of an element
`void` `startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)` This method is used to notify that an element is starting.
`void` `startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String elementName, Attributes atts)` Receive notification of the beginning of an element.
`void` `startEntity(java.lang.String name)` Pass the call on to the underlying handler
`void` `startPrefixMapping(java.lang.String prefix, java.lang.String uri)` Begin the scope of a prefix-URI Namespace mapping.
`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.

Methods inherited from class org.apache.xml.serializer.SerializerBase
`addAttributeAlways, characters, error, fatalError, fireEndEntity, setNamespaceMappings, warning`

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

Constructor Detail

### ToUnknownStream

    public ToUnknownStream()

  Default constructor. Initially this object wraps an XML Stream object, so _handler is never null. That may change later to an HTML Stream object.

Method Detail

### asContentHandler

    public ContentHandler asContentHandler()
                                    throws java.io.IOException

  Description copied from class: `SerializerBase`
  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`
  Overrides:
    `asContentHandler` in class `SerializerBase`
  Returns:
    the wrapped XML or HTML handler
  Throws:
    `java.io.IOException` - An I/O exception occured
  See Also:
    `Serializer.asContentHandler()`

### close

    public void close()

  Description copied from class: `SerializerBase`
  Flush and close the underlying java.io.Writer. This method applies to ToStream serializers, not ToSAXHandler serializers.

  Specified by:
    `close` in interface `SerializationHandler`
  Overrides:
    `close` in class `SerializerBase`
  See Also:
    `SerializationHandler.close()`

### getOutputFormat

    public java.util.Properties getOutputFormat()

  Description copied from interface: `Serializer`
  Returns the output format properties for this serializer.

  Returns:
    the properties of the underlying handler
  See Also:
    `Serializer.getOutputFormat()`

### getOutputStream

    public java.io.OutputStream getOutputStream()

  Description copied from interface: `Serializer`
  Get the output stream where the events will be serialized to.

  Returns:
    the OutputStream of the underlying XML or HTML handler
  See Also:
    `Serializer.getOutputStream()`

### getWriter

    public java.io.Writer getWriter()

  Description copied from interface: `Serializer`
  Get the character stream where the events will be serialized to.

  Returns:
    the Writer of the underlying XML or HTML handler
  See Also:
    `Serializer.getWriter()`

### reset

    public boolean reset()

  passes the call on to the underlying HTML or XML handler

  Specified by:
    `reset` in interface `Serializer`
  Overrides:
    `reset` in class `SerializerBase`
  Returns:
    ???
  See Also:
    `Serializer.reset()`

### serialize

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

  Converts the DOM node to output

  Parameters:
    `node` - the DOM node to transform to output
  Throws:
    `java.io.IOException`
  See Also:
    `DOMSerializer.serialize(Node)`

### setEscaping

    public boolean setEscaping(boolean escape)
                        throws SAXException

  Description copied from interface: `SerializationHandler`
  Turns special character escaping on/off. Note that characters will never, even if this option is set to 'true', be escaped within CDATA sections in output XML documents.

  Throws:
    `SAXException`
  See Also:
    `SerializationHandler.setEscaping(boolean)`

### setOutputFormat

    public void setOutputFormat(java.util.Properties format)

  Set the properties of the handler

  Parameters:
    `format` - the output properties to set
  See Also:
    `Serializer.setOutputFormat(Properties)`

### setOutputStream

    public void setOutputStream(java.io.OutputStream output)

  Sets the output stream to write to

  Parameters:
    `output` - the OutputStream to write to
  See Also:
    `Serializer.setOutputStream(OutputStream)`

### setWriter

    public void setWriter(java.io.Writer writer)

  Sets the writer to write to

  Parameters:
    `writer` - the writer to write to
  See Also:
    `Serializer.setWriter(Writer)`

### 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 SAXException

  Adds an attribute to the currenly open tag

  Specified by:
    `addAttribute` in interface `ExtendedContentHandler`
  Overrides:
    `addAttribute` in class `SerializerBase`
  Parameters:
    `uri` - the URI of a namespace
    `localName` - the attribute name, without prefix
    `rawName` - the attribute name, with prefix (if any)
    `type` - the type of the attribute, typically "CDATA"
    `value` - the value of the parameter
  Throws:
    `SAXException`
  See Also:
    `ExtendedContentHandler.addAttribute(String, String, String, String, String)`

### addAttribute

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

  Adds an attribute to the currenly open tag

  Specified by:
    `addAttribute` in interface `ExtendedContentHandler`
  Overrides:
    `addAttribute` in class `SerializerBase`
  Parameters:
    `value` - the value of the parameter
    `rawName` - the attribute's qualified name
  See Also:
    `ExtendedContentHandler.addAttribute(String, String)`

### addUniqueAttribute

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

  Adds a unique attribute to the currenly open tag

  Parameters:
    `rawName` - the fully qualified attribute name.
    `value` - the attribute value
    `flags` - a bitwise flag
  Throws:
    `SAXException`

### characters

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

  Converts the String to a character array and calls the SAX method characters(char[],int,int);

  Parameters:
    `chars` - the character data
  Throws:
    `SAXException`
  See Also:
    `ExtendedContentHandler.characters(String)`

### endElement

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

  Pass the call on to the underlying handler

  Parameters:
    `elementName` - the fully qualified element name.
  Throws:
    `SAXException`
  See Also:
    `ExtendedContentHandler.endElement(String)`

### startPrefixMapping

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

  Description copied from interface: `ContentHandler`
  Begin the scope of a prefix-URI Namespace mapping.

  The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the `http://xml.org/sax/features/namespaces` feature is true (the default).

  There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary.

  Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each other: all startPrefixMapping events will occur immediately before the corresponding `startElement` event, and all `endPrefixMapping` events will occur immediately after the corresponding `endElement` event, but their order is not otherwise guaranteed.

  There should never be start/endPrefixMapping events for the "xml" prefix, since it is predeclared and immutable.

  Parameters:
    `prefix` - The prefix that maps to the URI
    `uri` - The URI for the namespace
  Throws:
    `SAXException` - The client may throw an exception during processing.
  See Also:
    `ContentHandler.startPrefixMapping(String, String)`

### namespaceAfterStartElement

    public void namespaceAfterStartElement(java.lang.String prefix,
                                           java.lang.String uri)
                                    throws 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.

  Specified by:
    `namespaceAfterStartElement` in interface `ExtendedContentHandler`
  Overrides:
    `namespaceAfterStartElement` in class `SerializerBase`
  Parameters:
    `uri` - the URI of the namespace
    `prefix` - the prefix associated with the given URI.
  Throws:
    `SAXException`
  See Also:
    `ExtendedContentHandler.namespaceAfterStartElement(String, String)`

### startPrefixMapping

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

  Description copied from interface: `ExtendedContentHandler`
  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:
    `SAXException`

### setVersion

    public void setVersion(java.lang.String version)

  This method cannot be cached because default is different in HTML and XML (we need more than a boolean).

  Specified by:
    `setVersion` in interface `XSLOutputAttributes`
  Overrides:
    `setVersion` in class `SerializerBase`
  Parameters:
    `version` - the version of the output format.
  See Also:
    `XSLOutputAttributes.setVersion(String)`

### startDocument

    public void startDocument()
                       throws SAXException

  Description copied from class: `SerializerBase`
  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).

  Specified by:
    `startDocument` in interface `ContentHandler`
  Overrides:
    `startDocument` in class `SerializerBase`
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.startDocument()`

### startElement

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

  Description copied from interface: `ExtendedContentHandler`
  This method is used to notify of the start of an element

  Parameters:
    `qName` - the fully qualified name of the element
  Throws:
    `SAXException`

### startElement

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

  Description copied from interface: `ExtendedContentHandler`
  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:
    `namespaceURI` - the namespace URI of the element
    `localName` - the local name (without prefix) of the element
    `qName` - the qualified name of the element
  Throws:
    `SAXException`

### startElement

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

  Description copied from interface: `ContentHandler`
  Receive notification of the beginning of an element.

  The Parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding `endElement` event for every startElement event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding endElement event.

  This event allows up to three name components for each element:

  1. the Namespace URI;
  2. the local name; and
  3. the qualified (prefixed) name.

  Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes properties:

  - the Namespace URI and local name are required when the namespaces property is true (the default), and are optional when the namespaces property is false (if one is specified, both must be);
  - the qualified name is required when the namespace-prefixes property is true, and is optional when the namespace-prefixes property is false (the default).

  Note that the attribute list provided will contain only attributes with explicit values (specified or defaulted): #IMPLIED attributes will be omitted. The attribute list will contain attributes used for Namespace declarations (xmlns* attributes) only if the `http://xml.org/sax/features/namespace-prefixes` property is true (it is false by default, and support for a true value is optional).

  Like `characters()`, attribute values may have characters that need more than one `char` value.

  Parameters:
    `namespaceURI` - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
    `localName` - The local name (without prefix), or the empty string if Namespace processing is not being performed.
    `elementName` - The qualified name (with prefix), or the empty string if qualified names are not available.
    `atts` - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)`, `Attributes`

### comment

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

  Pass the call on to the underlying handler

  Specified by:
    `comment` in interface `ExtendedLexicalHandler`
  Overrides:
    `comment` in class `SerializerBase`
  Throws:
    `SAXException`
  See Also:
    `ExtendedLexicalHandler.comment(String)`

### getDoctypePublic

    public java.lang.String getDoctypePublic()

  Pass the call on to the underlying handler

  Specified by:
    `getDoctypePublic` in interface `XSLOutputAttributes`
  Overrides:
    `getDoctypePublic` in class `SerializerBase`
  Returns:
    the public identifier to be used in the DOCTYPE declaration in the output document.
  See Also:
    `XSLOutputAttributes.getDoctypePublic()`

### getDoctypeSystem

    public java.lang.String getDoctypeSystem()

  Pass the call on to the underlying handler

  Specified by:
    `getDoctypeSystem` in interface `XSLOutputAttributes`
  Overrides:
    `getDoctypeSystem` in class `SerializerBase`
  Returns:
    the system identifier to be used in the DOCTYPE declaration in the output document.
  See Also:
    `XSLOutputAttributes.getDoctypeSystem()`

### getEncoding

    public java.lang.String getEncoding()

  Pass the call on to the underlying handler

  Specified by:
    `getEncoding` in interface `XSLOutputAttributes`
  Overrides:
    `getEncoding` in class `SerializerBase`
  Returns:
    the character encoding to be used in the output document.
  See Also:
    `XSLOutputAttributes.getEncoding()`

### getIndent

    public boolean getIndent()

  Pass the call on to the underlying handler

  Specified by:
    `getIndent` in interface `XSLOutputAttributes`
  Overrides:
    `getIndent` in class `SerializerBase`
  Returns:
    true if the output document should be indented to visually indicate its structure.
  See Also:
    `XSLOutputAttributes.getIndent()`

### getIndentAmount

    public int getIndentAmount()

  Pass the call on to the underlying handler

  Specified by:
    `getIndentAmount` in interface `XSLOutputAttributes`
  Overrides:
    `getIndentAmount` in class `SerializerBase`
  Returns:
    the number of spaces to indent for each indentation level.
  See Also:
    `XSLOutputAttributes.getIndentAmount()`

### getMediaType

    public java.lang.String getMediaType()

  Pass the call on to the underlying handler

  Specified by:
    `getMediaType` in interface `XSLOutputAttributes`
  Overrides:
    `getMediaType` in class `SerializerBase`
  Returns:
    the mediatype the media-type or MIME type associated with the output document.
  See Also:
    `XSLOutputAttributes.getMediaType()`

### getOmitXMLDeclaration

    public boolean getOmitXMLDeclaration()

  Pass the call on to the underlying handler

  Specified by:
    `getOmitXMLDeclaration` in interface `XSLOutputAttributes`
  Overrides:
    `getOmitXMLDeclaration` in class `SerializerBase`
  Returns:
    true if the XML declaration is to be omitted from the output document.
  See Also:
    `XSLOutputAttributes.getOmitXMLDeclaration()`

### getStandalone

    public java.lang.String getStandalone()

  Pass the call on to the underlying handler

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

### getVersion

    public java.lang.String getVersion()

  Pass the call on to the underlying handler

  Specified by:
    `getVersion` in interface `XSLOutputAttributes`
  Overrides:
    `getVersion` in class `SerializerBase`
  Returns:
    the version of the output format.
  See Also:
    `XSLOutputAttributes.getVersion()`

### setDoctype

    public void setDoctype(java.lang.String system,
                           java.lang.String pub)

  Description copied from class: `SerializerBase`
  Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties

  Specified by:
    `setDoctype` in interface `XSLOutputAttributes`
  Overrides:
    `setDoctype` in class `SerializerBase`
  Parameters:
    `system` - the system identifier to be used in the DOCTYPE declaration in the output document.
    `pub` - the public identifier to be used in the DOCTYPE declaration in the output document.
  See Also:
    `XSLOutputAttributes.setDoctype(String, String)`

### setDoctypePublic

    public void setDoctypePublic(java.lang.String doctype)

  Set the doctype in the underlying XML handler. Remember that this method was called, just in case we need to transfer this doctype to an HTML handler

  Specified by:
    `setDoctypePublic` in interface `XSLOutputAttributes`
  Overrides:
    `setDoctypePublic` in class `SerializerBase`
  Parameters:
    `doctype` - the public doctype to set
  See Also:
    `XSLOutputAttributes.setDoctypePublic(String)`

### setDoctypeSystem

    public void setDoctypeSystem(java.lang.String doctype)

  Set the doctype in the underlying XML handler. Remember that this method was called, just in case we need to transfer this doctype to an HTML handler

  Specified by:
    `setDoctypeSystem` in interface `XSLOutputAttributes`
  Overrides:
    `setDoctypeSystem` in class `SerializerBase`
  Parameters:
    `doctype` - the system doctype to set
  See Also:
    `XSLOutputAttributes.setDoctypeSystem(String)`

### setEncoding

    public void setEncoding(java.lang.String encoding)

  Pass the call on to the underlying handler

  Specified by:
    `setEncoding` in interface `XSLOutputAttributes`
  Overrides:
    `setEncoding` in class `SerializerBase`
  See Also:
    `XSLOutputAttributes.setEncoding(String)`

### setIndent

    public void setIndent(boolean indent)

  Pass the call on to the underlying handler

  Specified by:
    `setIndent` in interface `XSLOutputAttributes`
  Overrides:
    `setIndent` in class `SerializerBase`
  Parameters:
    `indent` - true if the output document should be indented to visually indicate its structure.
  See Also:
    `XSLOutputAttributes.setIndent(boolean)`

### setIndentAmount

    public void setIndentAmount(int value)

  Pass the call on to the underlying handler

  Specified by:
    `setIndentAmount` in interface `SerializationHandler`
  Overrides:
    `setIndentAmount` in class `SerializerBase`
  Parameters:
    `value` - The m_indentAmount to set

### setMediaType

    public void setMediaType(java.lang.String mediaType)

  Description copied from class: `SerializerBase`
  Sets the value coming from the xsl:output media-type stylesheet attribute.

  Specified by:
    `setMediaType` in interface `XSLOutputAttributes`
  Overrides:
    `setMediaType` in class `SerializerBase`
  Parameters:
    `mediaType` - the non-null media-type or MIME type associated with the output document.
  See Also:
    `XSLOutputAttributes.setMediaType(String)`

### setOmitXMLDeclaration

    public void setOmitXMLDeclaration(boolean b)

  Pass the call on to the underlying handler

  Specified by:
    `setOmitXMLDeclaration` in interface `XSLOutputAttributes`
  Overrides:
    `setOmitXMLDeclaration` in class `SerializerBase`
  Parameters:
    `b` - true if the XML declaration is to be omitted from the output document.
  See Also:
    `XSLOutputAttributes.setOmitXMLDeclaration(boolean)`

### setStandalone

    public void setStandalone(java.lang.String standalone)

  Pass the call on to the underlying handler

  Specified by:
    `setStandalone` in interface `XSLOutputAttributes`
  Overrides:
    `setStandalone` in class `SerializerBase`
  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.
  See Also:
    `XSLOutputAttributes.setStandalone(String)`

### 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

  Pass the call on to the underlying handler

  Parameters:
    `arg0` - The name of the associated element.
    `arg1` - The name of the attribute.
    `arg2` - A string representing the attribute type.
    `arg3` - A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.
    `arg4` - A string representing the attribute's default value, or null if there is none.
  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `DeclHandler.attributeDecl(String, String, String, String, String)`

### elementDecl

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

  Pass the call on to the underlying handler

  Parameters:
    `arg0` - The element type name.
    `arg1` - The content model as a normalized string.
  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `DeclHandler.elementDecl(String, String)`

### externalEntityDecl

    public void externalEntityDecl(java.lang.String name,
                                   java.lang.String publicId,
                                   java.lang.String systemId)
                            throws SAXException

  Pass the call on to the underlying handler

  Parameters:
    `name` - The name of the entity. If it is a parameter entity, the name will begin with '%'.
    `publicId` - The declared public identifier of the entity, or null if none was declared.
    `systemId` - The declared system identifier of the entity.
  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `DeclHandler.externalEntityDecl(String, String, String)`

### internalEntityDecl

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

  Pass the call on to the underlying handler

  Parameters:
    `arg0` - The name of the entity. If it is a parameter entity, the name will begin with '%'.
    `arg1` - The replacement text of the entity.
  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `DeclHandler.internalEntityDecl(String, String)`

### characters

    public void characters(char[] characters,
                           int offset,
                           int length)
                    throws SAXException

  Pass the call on to the underlying handler

  Parameters:
    `characters` - The characters from the XML document.
    `offset` - The start position in the array.
    `length` - The number of characters to read from the array.
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.characters(char[], int, int)`

### endDocument

    public void endDocument()
                     throws SAXException

  Pass the call on to the underlying handler

  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.endDocument()`

### endElement

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

  Pass the call on to the underlying handler

  Parameters:
    `namespaceURI` - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
    `localName` - The local name (without prefix), or the empty string if Namespace processing is not being performed.
    `qName` - The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.endElement(String, String, String)`

### endPrefixMapping

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

  Pass the call on to the underlying handler

  Parameters:
    `prefix` - The prefix that was being mapping. This is the empty string when a default mapping scope ends.
  Throws:
    `SAXException` - The client may throw an exception during processing.
  See Also:
    `ContentHandler.endPrefixMapping(String)`

### ignorableWhitespace

    public void ignorableWhitespace(char[] ch,
                                    int start,
                                    int length)
                             throws SAXException

  Pass the call on to the underlying handler

  Parameters:
    `ch` - The characters from the XML document.
    `start` - The start position in the array.
    `length` - The number of characters to read from the array.
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.ignorableWhitespace(char[], int, int)`

### processingInstruction

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

  Pass the call on to the underlying handler

  Parameters:
    `target` - The processing instruction target.
    `data` - The processing instruction data, or null if none was supplied. The data does not include any whitespace separating it from the target.
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.processingInstruction(String, String)`

### setDocumentLocator

    public void setDocumentLocator(Locator locator)

  Pass the call on to the underlying handler

  Specified by:
    `setDocumentLocator` in interface `ContentHandler`
  Overrides:
    `setDocumentLocator` in class `SerializerBase`
  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.

  See Also:
    `ContentHandler.setDocumentLocator(Locator)`

### skippedEntity

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

  Pass the call on to the underlying handler

  Parameters:
    `name` - The name of the skipped entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be the string "[dtd]".
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `ContentHandler.skippedEntity(String)`

### comment

    public void comment(char[] ch,
                        int start,
                        int length)
                 throws SAXException

  Pass the call on to the underlying handler

  Parameters:
    `ch` - An array holding the characters in the comment.
    `start` - The starting position in the array.
    `length` - The number of characters to use from the array.
  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.comment(char[], int, int)`

### endCDATA

    public void endCDATA()
                  throws SAXException

  Pass the call on to the underlying handler

  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.endCDATA()`

### endDTD

    public void endDTD()
                throws SAXException

  Pass the call on to the underlying handler

  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.endDTD()`

### endEntity

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

  Pass the call on to the underlying handler

  Specified by:
    `endEntity` in interface `LexicalHandler`
  Overrides:
    `endEntity` in class `SerializerBase`
  Parameters:
    `name` - The name of the entity that is ending.
  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.endEntity(String)`

### startCDATA

    public void startCDATA()
                    throws SAXException

  Pass the call on to the underlying handler

  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.startCDATA()`

### startDTD

    public void startDTD(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
                  throws SAXException

  Pass the call on to the underlying handler

  Parameters:
    `name` - The document type name.
    `publicId` - The declared public identifier for the external DTD subset, or null if none was declared.
    `systemId` - The declared system identifier for the external DTD subset, or null if none was declared. (Note that this is not resolved against the document base URI.)
  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.startDTD(String, String, String)`

### startEntity

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

  Pass the call on to the underlying handler

  Parameters:
    `name` - The name of the entity. If it is a parameter entity, the name will begin with '%', and if it is the external DTD subset, it will be "[dtd]".
  Throws:
    `SAXException` - The application may raise an exception.
  See Also:
    `LexicalHandler.startEntity(String)`

### asDOMSerializer

    public DOMSerializer asDOMSerializer()
                                  throws java.io.IOException

  Description copied from class: `SerializerBase`
  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`
  Overrides:
    `asDOMSerializer` in class `SerializerBase`
  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()`

### setCdataSectionElements

    public void setCdataSectionElements(java.util.Vector URI_and_localNames)

  Description copied from interface: `XSLOutputAttributes`
  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` - Vector a list of pairs of URI/localName specified in the cdata-section-elements attribute
  See Also:
    `XSLOutputAttributes.setCdataSectionElements(java.util.Vector)`

### addAttributes

    public void addAttributes(Attributes atts)
                       throws SAXException

  Description copied from class: `SerializerBase`
  Add the given attributes to the currently collected ones. These attributes are always added, regardless of whether on not an element is currently open.

  Specified by:
    `addAttributes` in interface `ExtendedContentHandler`
  Overrides:
    `addAttributes` in class `SerializerBase`
  Parameters:
    `atts` - List of attributes to add to this list
  Throws:
    `SAXException`
  See Also:
    `ExtendedContentHandler.addAttributes(org.xml.sax.Attributes)`

### getNamespaceMappings

    public NamespaceMappings getNamespaceMappings()

  Get the current namespace mappings. Simply returns the mappings of the wrapped handler.

  Specified by:
    `getNamespaceMappings` in interface `ExtendedContentHandler`
  Overrides:
    `getNamespaceMappings` in class `SerializerBase`
  Returns:
    the current namespace mappings (prefix/uri)
  See Also:
    `ExtendedContentHandler.getNamespaceMappings()`

### flushPending

    public void flushPending()
                      throws SAXException

  Description copied from interface: `SerializationHandler`
  Flush any pending events currently queued up in the serializer. This will flush any input that the serializer has which it has not yet sent as output.

  Throws:
    `SAXException`
  See Also:
    `SerializationHandler.flushPending()`

### getPrefix

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

  Description copied from class: `SerializerBase`
  Returns the prefix currently pointing to the given URI (if any).

  Specified by:
    `getPrefix` in interface `ExtendedContentHandler`
  Overrides:
    `getPrefix` in class `SerializerBase`
  Parameters:
    `namespaceURI` - the uri of the namespace in question
  Returns:
    a prefix pointing to the given URI (if any).
  See Also:
    `ExtendedContentHandler.getPrefix(java.lang.String)`

### entityReference

    public void entityReference(java.lang.String entityName)
                         throws SAXException

  Description copied from class: `SerializerBase`
  Entity reference event.

  Specified by:
    `entityReference` in interface `ExtendedContentHandler`
  Overrides:
    `entityReference` in class `SerializerBase`
  Parameters:
    `entityName` - Name of entity
  Throws:
    `SAXException`
  See Also:
    `ExtendedContentHandler.entityReference(java.lang.String)`

### getNamespaceURI

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

  Description copied from class: `SerializerBase`
  Returns the URI of an element or attribute. Note that default namespaces do not apply directly to attributes.

  Specified by:
    `getNamespaceURI` in interface `ExtendedContentHandler`
  Overrides:
    `getNamespaceURI` in class `SerializerBase`
  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.
  See Also:
    `ExtendedContentHandler.getNamespaceURI(java.lang.String, boolean)`

### getNamespaceURIFromPrefix

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

  Description copied from class: `SerializerBase`
  Returns the URI of prefix (if any)

  Specified by:
    `getNamespaceURIFromPrefix` in interface `ExtendedContentHandler`
  Overrides:
    `getNamespaceURIFromPrefix` in class `SerializerBase`
  Parameters:
    `prefix` - the prefix whose URI is searched for
  Returns:
    the namespace URI currently associated with the prefix, null if the prefix is undefined.

### setTransformer

    public void setTransformer(Transformer t)

  Description copied from class: `SerializerBase`
  Sets the transformer associated with this serializer

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

### getTransformer

    public Transformer getTransformer()

  Description copied from class: `SerializerBase`
  Gets the transformer associated with this serializer

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

### setContentHandler

    public void setContentHandler(ContentHandler ch)

  Description copied from interface: `SerializationHandler`
  Set the SAX Content handler that the serializer sends its output to. This method only applies to a ToSAXHandler, not to a ToStream serializer.

  See Also:
    `SerializationHandler.setContentHandler(org.xml.sax.ContentHandler)`

### setSourceLocator

    public void setSourceLocator(SourceLocator locator)

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

  Specified by:
    `setSourceLocator` in interface `ExtendedContentHandler`
  Overrides:
    `setSourceLocator` in class `SerializerBase`
  Parameters:
    `locator` - the source locator
  See Also:
    `ExtendedContentHandler.setSourceLocator(javax.xml.transform.SourceLocator)`

Copyright © 2004 Apache XML Project. All Rights Reserved.