Class DOMSerializerImpl

  • All Implemented Interfaces:
    DOMConfiguration, LSSerializer

    public class DOMSerializerImpl
    extends Object
    implements LSSerializer, DOMConfiguration
    Deprecated.
    Replaced by org.apache.xml.serializer.dom3.LSSerializerImpl in Xerces 2.9.0.
    EXPERIMENTAL: Implemenatation of DOM Level 3 org.w3c.ls.LSSerializer by delegating serialization calls to XMLSerializer. LSSerializer provides an API for serializing (writing) a DOM document out in an XML document. The XML data is written to an output stream. During serialization of XML data, namespace fixup is done when possible as defined in DOM Level 3 Core, Appendix B.
    Version:
    $Id$
    Author:
    Elena Litani, IBM, Gopal Sharma, Sun Microsystems, Arun Yadav, Sun Microsystems
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static short CDATA
      Deprecated.
       
      protected static short COMMENTS
      Deprecated.
       
      protected static short DISCARDDEFAULT
      Deprecated.
       
      protected static short DOM_ELEMENT_CONTENT_WHITESPACE
      Deprecated.
       
      protected static short ENTITIES
      Deprecated.
       
      protected short features
      Deprecated.
      REVISIT: Currently we handle 3 different configurations, would be nice just have one configuration that has different recognized parameters depending if it is used in Core/LS.
      protected static short INFOSET
      Deprecated.
       
      protected static short NAMESPACES
      Deprecated.
       
      protected static short NSDECL
      Deprecated.
       
      protected static short PRETTY_PRINT
      Deprecated.
       
      protected static short SPLITCDATA
      Deprecated.
       
      protected static short WELLFORMED
      Deprecated.
       
      protected static short XMLDECL
      Deprecated.
       
    • Constructor Summary

      Constructors 
      Constructor Description
      DOMSerializerImpl()
      Deprecated.
      Constructs a new LSSerializer.
    • Field Detail

      • features

        protected short features
        Deprecated.
        REVISIT: Currently we handle 3 different configurations, would be nice just have one configuration that has different recognized parameters depending if it is used in Core/LS.
      • DISCARDDEFAULT

        protected static final short DISCARDDEFAULT
        Deprecated.
        See Also:
        Constant Field Values
      • DOM_ELEMENT_CONTENT_WHITESPACE

        protected static final short DOM_ELEMENT_CONTENT_WHITESPACE
        Deprecated.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DOMSerializerImpl

        public DOMSerializerImpl()
        Deprecated.
        Constructs a new LSSerializer. The constructor turns on the namespace support in XMLSerializer and initializes the following fields: fNSBinder, fLocalNSBinder, fSymbolTable, fEmptySymbol, fXmlSymbol, fXmlnsSymbol, fNamespaceCounter, fFeatures.
    • Method Detail

      • getParameterNames

        public DOMStringList getParameterNames()
        Deprecated.
        DOM Level 3 Core CR - Experimental. The list of the parameters supported by this DOMConfiguration object and for which at least one value can be set by the application. Note that this list can also contain parameter names defined outside this specification.
        Specified by:
        getParameterNames in interface DOMConfiguration
      • writeToString

        public String writeToString​(Node wnode)
                             throws DOMException,
                                    LSException
        Deprecated.
        DOM L3 EXPERIMENTAL: Serialize the specified node as described above in the description of LSSerializer. The result of serializing the node is returned as a string. Writing a Document or Entity node produces a serialized form that is well formed XML. Writing other node types produces a fragment of text in a form that is not fully defined by this document, but that should be useful to a human for debugging or diagnostic purposes.
        Specified by:
        writeToString in interface LSSerializer
        Parameters:
        wnode - The node to be written.
        Returns:
        Returns the serialized data
        Throws:
        DOMException - DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a DOMString.
        LSException - SERIALIZE_ERR: Unable to serialize the node. DOM applications should attach a DOMErrorHandler using the parameter "error-handler" to get details on error.
      • setNewLine

        public void setNewLine​(String newLine)
        Deprecated.
        DOM L3 EXPERIMENTAL: The end-of-line sequence of characters to be used in the XML being written out. The only permitted values are these:
        null
        Use a default end-of-line sequence. DOM implementations should choose the default to match the usual convention for text files in the environment being used. Implementations must choose a default sequence that matches one of those allowed by 2.11 "End-of-Line Handling".
        CR
        The carriage-return character (#xD).
        CR-LF
        The carriage-return and line-feed characters (#xD #xA).
        LF
        The line-feed character (#xA).

        The default value for this attribute is null.
        Specified by:
        setNewLine in interface LSSerializer
      • getNewLine

        public String getNewLine()
        Deprecated.
        DOM L3 EXPERIMENTAL: The end-of-line sequence of characters to be used in the XML being written out. The only permitted values are these:
        null
        Use a default end-of-line sequence. DOM implementations should choose the default to match the usual convention for text files in the environment being used. Implementations must choose a default sequence that matches one of those allowed by 2.11 "End-of-Line Handling".
        CR
        The carriage-return character (#xD).
        CR-LF
        The carriage-return and line-feed characters (#xD #xA).
        LF
        The line-feed character (#xA).

        The default value for this attribute is null.
        Specified by:
        getNewLine in interface LSSerializer
      • getFilter

        public LSSerializerFilter getFilter()
        Deprecated.
        When the application provides a filter, the serializer will call out to the filter before serializing each Node. Attribute nodes are never passed to the filter. The filter implementation can choose to remove the node from the stream or to terminate the serialization early.
        Specified by:
        getFilter in interface LSSerializer
      • setFilter

        public void setFilter​(LSSerializerFilter filter)
        Deprecated.
        When the application provides a filter, the serializer will call out to the filter before serializing each Node. Attribute nodes are never passed to the filter. The filter implementation can choose to remove the node from the stream or to terminate the serialization early.
        Specified by:
        setFilter in interface LSSerializer
      • write

        public boolean write​(Node node,
                             LSOutput destination)
                      throws LSException
        Deprecated.
        Serialize the specified node as described above in the general description of the LSSerializer interface. The output is written to the supplied LSOutput.
        When writing to a LSOutput, the encoding is found by looking at the encoding information that is reachable through the LSOutput and the item to be written (or its owner document) in this order:
        1. LSOutput.encoding,
        2. Document.actualEncoding,
        3. Document.xmlEncoding.

        If no encoding is reachable through the above properties, a default encoding of "UTF-8" will be used.
        If the specified encoding is not supported an "unsupported-encoding" error is raised.
        If no output is specified in the LSOutput, a "no-output-specified" error is raised.
        Specified by:
        write in interface LSSerializer
        Parameters:
        node - The node to serialize.
        destination - The destination for the serialized DOM.
        Returns:
        Returns true if node was successfully serialized and false in case the node couldn't be serialized.
        Throws:
        LSException
      • writeToURI

        public boolean writeToURI​(Node node,
                                  String URI)
                           throws LSException
        Deprecated.
        Serialize the specified node as described above in the general description of the LSSerializer interface. The output is written to the supplied URI.
        When writing to a URI, the encoding is found by looking at the encoding information that is reachable through the item to be written (or its owner document) in this order:
        1. Document.inputEncoding,
        2. Document.xmlEncoding.

        If no encoding is reachable through the above properties, a default encoding of "UTF-8" will be used.
        If the specified encoding is not supported an "unsupported-encoding" error is raised.
        Specified by:
        writeToURI in interface LSSerializer
        Parameters:
        node - The node to serialize.
        URI - The URI to write to.
        Returns:
        Returns true if node was successfully serialized and false in case the node couldn't be serialized.
        Throws:
        LSException