#include <DOMLSSerializer.hpp>
Public Member Functions | |
Destructor | |
virtual | ~DOMLSSerializer () |
Destructor. | |
Functions introduced in DOM Level 3 | |
virtual DOMConfiguration * | getDomConfig ()=0 |
The DOMConfiguration object used by the LSSerializer when serializing a DOM node. | |
virtual void | setNewLine (const XMLCh *const newLine)=0 |
The end-of-line sequence of characters to be used in the XML being written out. | |
virtual void | setFilter (DOMLSSerializerFilter *filter)=0 |
When the application provides a filter, the serializer will call out to the filter before serializing each Node. | |
virtual const XMLCh * | getNewLine () const =0 |
Return the end-of-line sequence of characters to be used in the XML being written out. | |
virtual DOMLSSerializerFilter * | getFilter () const =0 |
Return the WriterFilter used. | |
virtual bool | write (const DOMNode *nodeToWrite, DOMLSOutput *const destination)=0 |
Write out the specified node as described above in the description of DOMLSSerializer . | |
virtual bool | writeToURI (const DOMNode *nodeToWrite, const XMLCh *uri)=0 |
Write out the specified node as described above in the description of DOMLSSerializer . | |
virtual XMLCh * | writeToString (const DOMNode *nodeToWrite, MemoryManager *manager=NULL)=0 |
Serialize the specified node as described above in the description of DOMLSSerializer . | |
Non-standard Extension | |
virtual void | release ()=0 |
Called to indicate that this Writer is no longer in use and that the implementation may relinquish any resources associated with it. | |
Protected Member Functions | |
Hidden constructors | |
DOMLSSerializer () |
xercesc::DOMLSSerializer::DOMLSSerializer | ( | ) | [inline, protected] |
virtual xercesc::DOMLSSerializer::~DOMLSSerializer | ( | ) | [inline, virtual] |
Destructor.
virtual DOMConfiguration* xercesc::DOMLSSerializer::getDomConfig | ( | ) | [pure virtual] |
The DOMConfiguration object used by the LSSerializer when serializing a DOM node.
In addition to the parameters recognized in on the DOMConfiguration
interface defined in [DOM Level 3 Core], the DOMConfiguration
objects for DOMLSSerializer
add or modify the following parameters:
"canonical-form" true [optional] Writes the document according to the rules specified in [Canonical XML]. In addition to the behavior described in "canonical-form" [DOM Level 3 Core], setting this parameter to true will set the parameters "format-pretty-print", "discard-default-content", and "xml-declaration", to false. Setting one of those parameters to true will set this parameter to false. Serializing an XML 1.1 document when "canonical-form" is true will generate a fatal error. false [required] (default) Do not canonicalize the output.
"discard-default-content" true [required] (default) Use the DOMAttr::getSpecified attribute to decide what attributes should be discarded. Note that some implementations might use whatever information available to the implementation (i.e. XML schema, DTD, the DOMAttr::getSpecified attribute, and so on) to determine what attributes and content to discard if this parameter is set to true. false [required] Keep all attributes and all content.
"format-pretty-print" true [optional] Formatting the output by adding whitespace to produce a pretty-printed, indented, human-readable form. The exact form of the transformations is not specified by this specification. Pretty-printing changes the content of the document and may affect the validity of the document, validating implementations should preserve validity. false [required] (default) Don't pretty-print the result.
"ignore-unknown-character-denormalizations" true [required] (default) If, while verifying full normalization when [XML 1.1] is supported, a character is encountered for which the normalization properties cannot be determined, then raise a "unknown-character-denormalization" warning (instead of raising an error, if this parameter is not set) and ignore any possible denormalizations caused by these characters. false [optional] Report a fatal error if a character is encountered for which the processor cannot determine the normalization properties.
"normalize-characters" This parameter is equivalent to the one defined by DOMConfiguration
in [DOM Level 3 Core]. Unlike in the Core, the default value for this parameter is true. While DOM implementations are not required to support fully normalizing the characters in the document according to appendix E of [XML 1.1], this parameter must be activated by default if supported.
"xml-declaration" true [required] (default) If a DOMDocument, DOMElement, or DOMEntity node is serialized, the XML declaration, or text declaration, should be included. The version (DOMDocument::xmlVersion if the document is a Level 3 document and the version is non-null, otherwise use the value "1.0"), and the output encoding (see DOMLSSerializer::write for details on how to find the output encoding) are specified in the serialized XML declaration. false [required] Do not serialize the XML and text declarations. Report a "xml-declaration-needed" warning if this will cause problems (i.e. the serialized data is of an XML version other than [XML 1.0], or an encoding would be needed to be able to re-parse the serialized data).
"error-handler" Contains a DOMErrorHandler object. If an error is encountered in the document, the implementation will call back the DOMErrorHandler registered using this parameter. The implementation may provide a default DOMErrorHandler object. When called, DOMError::relatedData will contain the closest node to where the error occurred. If the implementation is unable to determine the node where the error occurs, DOMError::relatedData will contain the DOMDocument node. Mutations to the document from within an error handler will result in implementation dependent behavior.
virtual DOMLSSerializerFilter* xercesc::DOMLSSerializer::getFilter | ( | ) | const [pure virtual] |
virtual const XMLCh* xercesc::DOMLSSerializer::getNewLine | ( | ) | const [pure virtual] |
Return the end-of-line sequence of characters to be used in the XML being written out.
virtual void xercesc::DOMLSSerializer::release | ( | ) | [pure virtual] |
Called to indicate that this Writer is no longer in use and that the implementation may relinquish any resources associated with it.
Access to a released object will lead to unexpected result.
virtual void xercesc::DOMLSSerializer::setFilter | ( | DOMLSSerializerFilter * | filter | ) | [pure virtual] |
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.
filter | The writer filter to be used. |
virtual void xercesc::DOMLSSerializer::setNewLine | ( | const XMLCh *const | newLine | ) | [pure virtual] |
The end-of-line sequence of characters to be used in the XML being written out.
The only permitted values are these:
null
null
since otherwise automatic translation of LF to CR-LF on Windows for text files would result in such files containing CR-CR-LF. If you need Windows-style end of line sequences in your output, consider writing to a file opened in text mode or explicitly set this property to CR-LF.
The default value for this attribute is null
.
newLine | The end-of-line sequence of characters to be used. |
virtual bool xercesc::DOMLSSerializer::write | ( | const DOMNode * | nodeToWrite, | |
DOMLSOutput *const | destination | |||
) | [pure virtual] |
Write out the specified node as described above in the description of DOMLSSerializer
.
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.
nodeToWrite | 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. | |
destination | The destination for the data to be written. |
true
if node
was successfully serialized and false
in case a failure occured and the failure wasn't canceled by the error handler. virtual XMLCh* xercesc::DOMLSSerializer::writeToString | ( | const DOMNode * | nodeToWrite, | |
MemoryManager * | manager = NULL | |||
) | [pure virtual] |
Serialize the specified node as described above in the description of DOMLSSerializer
.
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.
nodeToWrite | The node to be written. | |
manager | The memory manager to be used to allocate the result string. If NULL is used, the memory manager used to construct the serializer will be used. |
null
in case a failure occured and the failure wasn't canceled by the error handler. The returned string is always in UTF-16. The encoding information available in DOMLSSerializer is ignored in writeToString(). virtual bool xercesc::DOMLSSerializer::writeToURI | ( | const DOMNode * | nodeToWrite, | |
const XMLCh * | uri | |||
) | [pure virtual] |
Write out the specified node as described above in the description of DOMLSSerializer
.
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.
nodeToWrite | 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. | |
uri | The destination for the data to be written. |
true
if node
was successfully serialized and false
in case a failure occured and the failure wasn't canceled by the error handler.