public class DOMSerializerImpl extends Object implements LSSerializer, DOMConfiguration
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.Modifier and Type | Field and 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 and Description |
---|
DOMSerializerImpl()
Deprecated.
Constructs a new LSSerializer.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canSetParameter(String name,
Object state)
Deprecated.
DOM L3-EXPERIMENTAL:
Check if parameter can be set
|
DOMConfiguration |
getDomConfig()
Deprecated.
|
LSSerializerFilter |
getFilter()
Deprecated.
When the application provides a filter, the serializer will call out
to the filter before serializing each Node.
|
String |
getNewLine()
Deprecated.
DOM L3 EXPERIMENTAL:
The end-of-line sequence of characters to be used in the XML being
written out.
|
Object |
getParameter(String name)
Deprecated.
DOM L3-EXPERIMENTAL:
Getter for boolean and object parameters
|
DOMStringList |
getParameterNames()
Deprecated.
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 parameters
|
boolean |
write(Node node,
LSOutput destination)
Deprecated.
Serialize the specified node as described above in the general
description of the
LSSerializer interface. |
String |
writeToString(Node wnode)
Deprecated.
DOM L3 EXPERIMENTAL:
Serialize the specified node as described above in the description of
LSSerializer . |
boolean |
writeToURI(Node node,
String URI)
Deprecated.
Serialize the specified node as described above in the general
description of the
LSSerializer interface. |
protected short features
protected static final short NAMESPACES
protected static final short WELLFORMED
protected static final short ENTITIES
protected static final short CDATA
protected static final short SPLITCDATA
protected static final short COMMENTS
protected static final short DISCARDDEFAULT
protected static final short INFOSET
protected static final short XMLDECL
protected static final short NSDECL
protected static final short DOM_ELEMENT_CONTENT_WHITESPACE
protected static final short PRETTY_PRINT
public DOMSerializerImpl()
XMLSerializer
and
initializes the following fields: fNSBinder, fLocalNSBinder, fSymbolTable,
fEmptySymbol, fXmlSymbol, fXmlnsSymbol, fNamespaceCounter, fFeatures.public DOMConfiguration getDomConfig()
getDomConfig
in interface LSSerializer
public void setParameter(String name, Object value) throws DOMException
setParameter
in interface DOMConfiguration
DOMException
public boolean canSetParameter(String name, Object state)
canSetParameter
in interface DOMConfiguration
public DOMStringList getParameterNames()
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.getParameterNames
in interface DOMConfiguration
public Object getParameter(String name) throws DOMException
getParameter
in interface DOMConfiguration
DOMException
public String writeToString(Node wnode) throws DOMException, LSException
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.writeToString
in interface LSSerializer
wnode
- The node to be written.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.public void setNewLine(String newLine)
null
null
.setNewLine
in interface LSSerializer
public String getNewLine()
null
null
.getNewLine
in interface LSSerializer
public LSSerializerFilter getFilter()
getFilter
in interface LSSerializer
public void setFilter(LSSerializerFilter filter)
setFilter
in interface LSSerializer
public boolean write(Node node, LSOutput destination) throws LSException
LSSerializer
interface. The output
is written to the supplied LSOutput
.
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:
LSOutput.encoding
,
Document.actualEncoding
,
Document.xmlEncoding
.
LSOutput
, a
"no-output-specified" error is raised.write
in interface LSSerializer
node
- The node to serialize.destination
- The destination for the serialized DOM.true
if node
was
successfully serialized and false
in case the node
couldn't be serialized.LSException
public boolean writeToURI(Node node, String URI) throws LSException
LSSerializer
interface. The output
is written to the supplied URI.
Document.inputEncoding
,
Document.xmlEncoding
.
writeToURI
in interface LSSerializer
node
- The node to serialize.URI
- The URI to write to.true
if node
was
successfully serialized and false
in case the node
couldn't be serialized.LSException
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.