Package org.apache.xml.serialize
Class DOMSerializerImpl
java.lang.Object
org.apache.xml.serialize.DOMSerializerImpl
- All Implemented Interfaces:
DOMConfiguration
,LSSerializer
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: DOMSerializerImpl.java 944789 2010-05-16 10:06:57Z mukulg $
- Author:
- Elena Litani, IBM, Gopal Sharma, Sun Microsystems, Arun Yadav, Sun Microsystems
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final short
Deprecated.protected static final short
Deprecated.protected static final short
Deprecated.protected static final short
Deprecated.protected static final short
Deprecated.protected short
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 final short
Deprecated.protected static final short
Deprecated.protected static final short
Deprecated.protected static final short
Deprecated.protected static final short
Deprecated.protected static final short
Deprecated.protected static final short
Deprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canSetParameter
(String name, Object state) Deprecated.DOM L3-EXPERIMENTAL: Check if parameter can be setDeprecated.Deprecated.When the application provides a filter, the serializer will call out to the filter before serializing each Node.Deprecated.DOM L3 EXPERIMENTAL: The end-of-line sequence of characters to be used in the XML being written out.getParameter
(String name) Deprecated.DOM L3-EXPERIMENTAL: Getter for boolean and object parametersDeprecated.DOM Level 3 Core CR - Experimental.void
setFilter
(LSSerializerFilter filter) Deprecated.When the application provides a filter, the serializer will call out to the filter before serializing each Node.void
setNewLine
(String newLine) Deprecated.DOM L3 EXPERIMENTAL: The end-of-line sequence of characters to be used in the XML being written out.void
setParameter
(String name, Object value) Deprecated.DOM L3-EXPERIMENTAL: Setter for boolean and object parametersboolean
Deprecated.Serialize the specified node as described above in the general description of theLSSerializer
interface.writeToString
(Node wnode) Deprecated.DOM L3 EXPERIMENTAL: Serialize the specified node as described above in the description ofLSSerializer
.boolean
writeToURI
(Node node, String URI) Deprecated.Serialize the specified node as described above in the general description of theLSSerializer
interface.
-
Field Details
-
features
protected short featuresDeprecated.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. -
NAMESPACES
protected static final short NAMESPACESDeprecated.- See Also:
-
WELLFORMED
protected static final short WELLFORMEDDeprecated.- See Also:
-
ENTITIES
protected static final short ENTITIESDeprecated.- See Also:
-
CDATA
protected static final short CDATADeprecated.- See Also:
-
SPLITCDATA
protected static final short SPLITCDATADeprecated.- See Also:
-
COMMENTS
protected static final short COMMENTSDeprecated.- See Also:
-
DISCARDDEFAULT
protected static final short DISCARDDEFAULTDeprecated.- See Also:
-
INFOSET
protected static final short INFOSETDeprecated.- See Also:
-
XMLDECL
protected static final short XMLDECLDeprecated.- See Also:
-
NSDECL
protected static final short NSDECLDeprecated.- See Also:
-
DOM_ELEMENT_CONTENT_WHITESPACE
protected static final short DOM_ELEMENT_CONTENT_WHITESPACEDeprecated.- See Also:
-
PRETTY_PRINT
protected static final short PRETTY_PRINTDeprecated.- See Also:
-
-
Constructor Details
-
DOMSerializerImpl
public DOMSerializerImpl()Deprecated.Constructs a new LSSerializer. The constructor turns on the namespace support inXMLSerializer
and initializes the following fields: fNSBinder, fLocalNSBinder, fSymbolTable, fEmptySymbol, fXmlSymbol, fXmlnsSymbol, fNamespaceCounter, fFeatures.
-
-
Method Details
-
getDomConfig
Deprecated.- Specified by:
getDomConfig
in interfaceLSSerializer
-
setParameter
Deprecated.DOM L3-EXPERIMENTAL: Setter for boolean and object parameters- Specified by:
setParameter
in interfaceDOMConfiguration
- Throws:
DOMException
-
canSetParameter
Deprecated.DOM L3-EXPERIMENTAL: Check if parameter can be set- Specified by:
canSetParameter
in interfaceDOMConfiguration
-
getParameterNames
Deprecated.DOM Level 3 Core CR - Experimental. The list of the parameters supported by thisDOMConfiguration
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 interfaceDOMConfiguration
-
getParameter
Deprecated.DOM L3-EXPERIMENTAL: Getter for boolean and object parameters- Specified by:
getParameter
in interfaceDOMConfiguration
- Throws:
DOMException
-
writeToString
Deprecated.DOM L3 EXPERIMENTAL: Serialize the specified node as described above in the description ofLSSerializer
. 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 interfaceLSSerializer
- 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 aDOMString
.LSException
- SERIALIZE_ERR: Unable to serialize the node. DOM applications should attach aDOMErrorHandler
using the parameter "error-handler" to get details on error.
-
setNewLine
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 isnull
.- Specified by:
setNewLine
in interfaceLSSerializer
-
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 isnull
.- Specified by:
getNewLine
in interfaceLSSerializer
-
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 interfaceLSSerializer
-
setFilter
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 interfaceLSSerializer
-
write
Deprecated.Serialize the specified node as described above in the general description of theLSSerializer
interface. The output is written to the suppliedLSOutput
.
When writing to aLSOutput
, the encoding is found by looking at the encoding information that is reachable through theLSOutput
and the item to be written (or its owner document) in this order:-
LSOutput.encoding
, -
Document.actualEncoding
, -
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 theLSOutput
, a "no-output-specified" error is raised.- Specified by:
write
in interfaceLSSerializer
- Parameters:
node
- The node to serialize.destination
- The destination for the serialized DOM.- Returns:
- Returns
true
ifnode
was successfully serialized andfalse
in case the node couldn't be serialized. - Throws:
LSException
-
-
writeToURI
Deprecated.Serialize the specified node as described above in the general description of theLSSerializer
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:-
Document.inputEncoding
, -
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 interfaceLSSerializer
- Parameters:
node
- The node to serialize.URI
- The URI to write to.- Returns:
- Returns
true
ifnode
was successfully serialized andfalse
in case the node couldn't be serialized. - Throws:
LSException
-
-