|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xml.serialize.DOMWriterImpl
Implemenatation of DOM Level 3 org.w3c.ls.DOMWriter by delegating serialization
calls to XMLSerializer
.
DOMWriter 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.
Constructor Summary | |
---|---|
DOMWriterImpl()
Constructs a new DOMWriter. |
Method Summary | |
---|---|
boolean |
canSetParameter(java.lang.String name,
java.lang.Object state)
DOM L3-EXPERIMENTAL: Check if parameter can be set |
org.apache.xerces.dom3.DOMConfiguration |
getConfig()
The configuration used when a document is loaded. |
java.lang.String |
getEncoding()
DOM L3 EXPERIMENTAL: The character encoding in which the output will be written. |
org.apache.xerces.dom3.DOMErrorHandler |
getErrorHandler()
The error handler that will receive error notifications during serialization. |
org.w3c.dom.ls.DOMWriterFilter |
getFilter()
When the application provides a filter, the serializer will call out to the filter before serializing each Node. |
java.lang.String |
getNewLine()
DOM L3 EXPERIMENTAL: The end-of-line sequence of characters to be used in the XML being written out. |
java.lang.Object |
getParameter(java.lang.String name)
DOM L3-EXPERIMENTAL: Getter for boolean and object parameters |
void |
setEncoding(java.lang.String encoding)
DOM L3 EXPERIMENTAL: The character encoding in which the output will be written. |
void |
setErrorHandler(org.apache.xerces.dom3.DOMErrorHandler errorHandler)
DOM L3 EXPERIMENTAL: The error handler that will receive error notifications during serialization. |
void |
setFilter(org.w3c.dom.ls.DOMWriterFilter filter)
When the application provides a filter, the serializer will call out to the filter before serializing each Node. |
void |
setNewLine(java.lang.String newLine)
DOM L3 EXPERIMENTAL: The end-of-line sequence of characters to be used in the XML being written out. |
void |
setParameter(java.lang.String name,
java.lang.Object value)
DOM L3-EXPERIMENTAL: Setter for boolean and object parameters |
boolean |
writeNode(java.io.OutputStream destination,
org.w3c.dom.Node wnode)
DOM L3 EXPERIMENTAL: Write out the specified node as described above in the description of DOMWriter . |
java.lang.String |
writeToString(org.w3c.dom.Node wnode)
DOM L3 EXPERIMENTAL: Serialize the specified node as described above in the description of DOMWriter . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DOMWriterImpl()
XMLSerializer
and
initializes the following fields: fNSBinder, fLocalNSBinder, fSymbolTable,
fEmptySymbol, fXmlSymbol, fXmlnsSymbol, fNamespaceCounter, fFeatures.Method Detail |
public org.apache.xerces.dom3.DOMConfiguration getConfig()
org.w3c.dom.ls.DOMWriter
DOMConfiguration
objects for
DOMWriter
adds, or modifies, the following boolean
parameters:
"entity-resolver"
"entity-resolver"
parameter defined in
DOMBuilder.config
. "xml-declaration"
true
Document
Node
or an Entity
node is serialized, the XML declaration, or
text declaration, should be included Document.version
and/or an encoding is specified. false
"canonical-form"
true
"format-pretty-print"
to false. false
"format-pretty-print"
true
false
"normalize-characters"
DOMConfiguration
in [DOM Level 3 Core]. Unlike in the Core, the default
value for this boolean parameter is true
. While DOM
implementations are not required to implement the W3C Text
Normalization defined in [CharModel], this boolean parameter must be activated
by default if supported. "unknown-characters"
true
false
getConfig
in interface org.w3c.dom.ls.DOMWriter
public void setParameter(java.lang.String name, java.lang.Object value) throws org.w3c.dom.DOMException
setParameter
in interface org.apache.xerces.dom3.DOMConfiguration
org.apache.xerces.dom3.DOMConfiguration
name
- The name of the parameter to set.value
- The new value or null
if the user wishes to
unset the parameter. While the type of the value parameter is
defined as DOMUserData
, the object type must match the
type defined by the definition of the parameter. For example, if
the parameter is "error-handler"
, the value must be of
type DOMErrorHandler
. Should we allow implementations
to raise exception if the type does not match? INVALID_ACCESS_ERR
seems the closest exception code...org.w3c.dom.DOMException
- NOT_SUPPORTED_ERR: Raised when the parameter name is recognized but
the requested value cannot be set.
public boolean canSetParameter(java.lang.String name, java.lang.Object state)
canSetParameter
in interface org.apache.xerces.dom3.DOMConfiguration
org.apache.xerces.dom3.DOMConfiguration
name
- The name of the parameter to check.value
- An object. if null
, the returned value is
true
.true
if the parameter could be successfully set
to the specified value, or false
if the parameter is
not recognized or the requested value is not supported. This does
not change the current value of the parameter itself.public java.lang.Object getParameter(java.lang.String name) throws org.w3c.dom.DOMException
getParameter
in interface org.apache.xerces.dom3.DOMConfiguration
org.apache.xerces.dom3.DOMConfiguration
name
- The name of the parameter.null
if no object has been associated or if the
parameter is not supported. "by a DOM application" prevents a DOM
implementation to return its default behavior (such as the default
"schema-type") if any.org.w3c.dom.DOMException
- NOT_FOUND_ERR: Raised when the parameter name is not recognized.public java.lang.String getEncoding()
null
or empty, but the item to be
written includes an encoding declaration, that value will be used.If
neither of the above provides an encoding name, a default encoding of
"UTF-8" will be used.
null
.getEncoding
in interface org.w3c.dom.ls.DOMWriter
public void setEncoding(java.lang.String encoding)
null
or empty, but the item to be
written includes an encoding declaration, that value will be used.If
neither of the above provides an encoding name, a default encoding of
"UTF-8" will be used.
null
.setEncoding
in interface org.w3c.dom.ls.DOMWriter
public org.apache.xerces.dom3.DOMErrorHandler getErrorHandler()
public void setErrorHandler(org.apache.xerces.dom3.DOMErrorHandler errorHandler)
public boolean writeNode(java.io.OutputStream destination, org.w3c.dom.Node wnode)
DOMWriter
. 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.writeNode
in interface org.w3c.dom.ls.DOMWriter
destination
- The destination for the data to be written.wnode
- The Document
or Entity
node to
be written. For other node types, something sensible should be
written, but the exact serialized form is not specified.true
if node
was
successfully serialized and false
in case a failure
occured and the failure wasn't canceled by the error handler.none
- public java.lang.String writeToString(org.w3c.dom.Node wnode) throws org.w3c.dom.DOMException
DOMWriter
. 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 org.w3c.dom.ls.DOMWriter
wnode
- The node to be written.null
in case a
failure occured and the failure wasn't canceled by the error
handler.org.w3c.dom.DOMException
- DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a
DOMString
.public void setNewLine(java.lang.String newLine)
null
null
.setNewLine
in interface org.w3c.dom.ls.DOMWriter
public java.lang.String getNewLine()
null
null
.getNewLine
in interface org.w3c.dom.ls.DOMWriter
public org.w3c.dom.ls.DOMWriterFilter getFilter()
getFilter
in interface org.w3c.dom.ls.DOMWriter
public void setFilter(org.w3c.dom.ls.DOMWriterFilter filter)
setFilter
in interface org.w3c.dom.ls.DOMWriter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |