DOMLSSerializer Class Referenceabstract

`#include <xercesc/dom/DOMLSSerializer.hpp>`

## Public Member Functions

Destructor
virtual | ~DOMLSSerializer ()
| Destructor. More...
Functions introduced in DOM Level 3
virtual DOMConfiguration * | getDomConfig ()=0
| The DOMConfiguration object used by the LSSerializer when serializing a DOM node. More...
virtual void | setNewLine (const XMLCh *const newLine)=0
| The end-of-line sequence of characters to be used in the XML being written out. More...
virtual void | setFilter (DOMLSSerializerFilter *filter)=0
| When the application provides a filter, the serializer will call out to the filter before serializing each Node. More...
virtual const XMLCh * | getNewLine () const =0
| Return the end-of-line sequence of characters to be used in the XML being written out. More...
virtual DOMLSSerializerFilter * | getFilter () const =0
| Return the WriterFilter used. More...
virtual bool | write (const DOMNode *nodeToWrite, DOMLSOutput *const destination)=0
| Write out the specified node as described above in the description of `DOMLSSerializer`. More...
virtual bool | writeToURI (const DOMNode *nodeToWrite, const XMLCh *uri)=0
| Write out the specified node as described above in the description of `DOMLSSerializer`. More...
virtual XMLCh * | writeToString (const DOMNode *nodeToWrite, MemoryManager *manager=NULL)=0
| Serialize the specified node as described above in the description of `DOMLSSerializer`. More...
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. More...

## Protected Member Functions

Hidden constructors
| DOMLSSerializer ()

## Constructor & Destructor Documentation

## DOMLSSerializer()

DOMLSSerializer::DOMLSSerializer | ( |  | ) |

protected

## ~DOMLSSerializer()

virtual DOMLSSerializer::~DOMLSSerializer | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## getDomConfig()

virtual DOMConfiguration * 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.

Returns
  The pointer to the configuration object.

Since
  DOM Level 3

## getFilter()

virtual DOMLSSerializerFilter * DOMLSSerializer::getFilter | ( |  | ) | const

pure virtual

Return the WriterFilter used.

Returns
  The writer filter used.

See also
  setFilter

Since
  DOM Level 3

## getNewLine()

virtual const XMLCh * DOMLSSerializer::getNewLine | ( |  | ) | const

pure virtual

Return the end-of-line sequence of characters to be used in the XML being written out.

Returns
  The end-of-line sequence of characters to be used.

See also
  setNewLine

Since
  DOM Level 3

## release()

virtual void 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.

## setFilter()

virtual void 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.

Parameters

  filter | The writer filter to be used.

See also
  getFilter

Since
  DOM Level 3

## setNewLine()

virtual void 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`
  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". However, Xerces-C++ always uses LF when this property is set to `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.
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`.

Parameters

  newLine | The end-of-line sequence of characters to be used.

See also
  getNewLine

Since
  DOM Level 3

## write()

virtual bool 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.

Parameters

  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.

Returns
  Returns `true` if `node` was successfully serialized and `false` in case a failure occured and the failure wasn't canceled by the error handler.

Since
  DOM Level 3

## writeToString()

virtual XMLCh * 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.

Parameters

  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.

Returns
  Returns the serialized data, or `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().

Since
  DOM Level 3

## writeToURI()

virtual bool 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.

Parameters

  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.

Returns
  Returns `true` if `node` was successfully serialized and `false` in case a failure occured and the failure wasn't canceled by the error handler.

Since
  DOM Level 3

The documentation for this class was generated from the following file:

- DOMLSSerializer.hpp