| java.lang.Object org.apache.xml.serialize.DOMSerializerImpl
DOMSerializerImpl | public class DOMSerializerImpl implements LSSerializer,DOMConfiguration(Code) | | 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.
author: Elena Litani, IBM author: Gopal Sharma, Sun Microsystems author: Arun Yadav, Sun Microsystems version: $Id: DOMSerializerImpl.java 476047 2006-11-17 04:27:45Z mrglavas $ |
Inner Class :static class DocumentMethods | |
Field Summary | |
final protected static short | CDATA | final protected static short | COMMENTS | final protected static short | DISCARDDEFAULT | final protected static short | DOM_ELEMENT_CONTENT_WHITESPACE | final protected static short | ENTITIES | final protected static short | INFOSET | final protected static short | NAMESPACES | final protected static short | NSDECL | final protected static short | PRETTY_PRINT | final protected static short | SPLITCDATA | final protected static short | WELLFORMED | final protected static short | XMLDECL | protected short | features 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. |
Method Summary | |
public boolean | canSetParameter(String name, Object state) | public DOMConfiguration | getDomConfig() | public LSSerializerFilter | getFilter() When the application provides a filter, the serializer will call out
to the filter before serializing each Node. | public String | getNewLine() DOM L3 EXPERIMENTAL:
The end-of-line sequence of characters to be used in the XML being
written out. | public Object | getParameter(String name) | public DOMStringList | getParameterNames() 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. | public void | setFilter(LSSerializerFilter filter) When the application provides a filter, the serializer will call out
to the filter before serializing each Node. | public void | setNewLine(String newLine) DOM L3 EXPERIMENTAL:
The end-of-line sequence of characters to be used in the XML being
written out. | public void | setParameter(String name, Object value) | public boolean | write(Node node, LSOutput destination) Serialize the specified node as described above in the general
description of the LSSerializer interface. | public String | writeToString(Node wnode) DOM L3 EXPERIMENTAL:
Serialize the specified node as described above in the description of
LSSerializer . | public boolean | writeToURI(Node node, String URI) Serialize the specified node as described above in the general
description of the LSSerializer interface. |
CDATA | final protected static short CDATA(Code) | | |
COMMENTS | final protected static short COMMENTS(Code) | | |
DISCARDDEFAULT | final protected static short DISCARDDEFAULT(Code) | | |
DOM_ELEMENT_CONTENT_WHITESPACE | final protected static short DOM_ELEMENT_CONTENT_WHITESPACE(Code) | | |
ENTITIES | final protected static short ENTITIES(Code) | | |
INFOSET | final protected static short INFOSET(Code) | | |
NAMESPACES | final protected static short NAMESPACES(Code) | | |
NSDECL | final protected static short NSDECL(Code) | | |
PRETTY_PRINT | final protected static short PRETTY_PRINT(Code) | | |
SPLITCDATA | final protected static short SPLITCDATA(Code) | | |
WELLFORMED | final protected static short WELLFORMED(Code) | | |
XMLDECL | final protected static short XMLDECL(Code) | | |
features | protected short features(Code) | | 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.
|
DOMSerializerImpl | public DOMSerializerImpl()(Code) | | 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.
|
canSetParameter | public boolean canSetParameter(String name, Object state)(Code) | | DOM L3-EXPERIMENTAL:
Check if parameter can be set
|
getFilter | public LSSerializerFilter getFilter()(Code) | | 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.
|
getNewLine | public String getNewLine()(Code) | | 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 .
|
getParameterNames | public DOMStringList getParameterNames()(Code) | | 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.
|
setFilter | public void setFilter(LSSerializerFilter filter)(Code) | | 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.
|
setNewLine | public void setNewLine(String newLine)(Code) | | 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 .
|
setParameter | public void setParameter(String name, Object value) throws DOMException(Code) | | DOM L3-EXPERIMENTAL:
Setter for boolean and object parameters
|
write | public boolean write(Node node, LSOutput destination) throws LSException(Code) | | 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:
-
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 the LSOutput , a
"no-output-specified" error is raised.
Parameters: node - The node to serialize. Parameters: destination - The destination for the serialized DOM. Returns true if node wassuccessfully serialized and false in case the nodecouldn't be serialized. |
writeToString | public String writeToString(Node wnode) throws DOMException, LSException(Code) | | 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.
Parameters: wnode - The node to be written. Returns the serialized data exception: DOMException - DOMSTRING_SIZE_ERR: The resulting string is too long to fit in aDOMString . exception: LSException - SERIALIZE_ERR: Unable to serialize the node. DOM applications shouldattach a DOMErrorHandler using the parameter "error-handler" to get details on error. |
writeToURI | public boolean writeToURI(Node node, String URI) throws LSException(Code) | | 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:
-
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.
Parameters: node - The node to serialize. Parameters: URI - The URI to write to. Returns true if node wassuccessfully serialized and false in case the nodecouldn't be serialized. |
|
|