# xercesc::DOMWriter Class Reference

`#include <DOMWriter.hpp>`

List of all members.

## Public Member Functions

Destructor
virtual | ~DOMWriter ()
| Destructor.
Functions introduced in DOM Level 3
virtual bool | canSetFeature (const XMLCh *const featName, bool state) const =0
| Query whether setting a feature to a specific value is supported.
virtual void | setFeature (const XMLCh *const featName, bool state)=0
| Set the state of a feature.
virtual bool | getFeature (const XMLCh *const featName) const =0
| Look up the value of a feature.
virtual void | setEncoding (const XMLCh *const encoding)=0
| The character encoding in which the output will be written.
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 | setErrorHandler (DOMErrorHandler *errorHandler)=0
| The error handler that will receive error notifications during serialization.
virtual void | setFilter (DOMWriterFilter *filter)=0
| When the application provides a filter, the serializer will call out to the filter before serializing each Node.
virtual const XMLCh * | getEncoding () const =0
| Return the character encoding in which the output will be written.
virtual const XMLCh * | getNewLine () const =0
| Return the end-of-line sequence of characters to be used in the XML being written out.
virtual DOMErrorHandler * | getErrorHandler () const =0
| Return the error handler that will receive error notifications during serialization.
virtual DOMWriterFilter * | getFilter () const =0
| Return the WriterFilter used.
virtual bool | writeNode (XMLFormatTarget *const destination, const DOMNode &nodeToWrite)=0
| Write out the specified node as described above in the description of `DOMWriter`.
virtual XMLCh * | writeToString (const DOMNode &nodeToWrite)=0
| Serialize the specified node as described above in the description of `DOMWriter`.
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
| DOMWriter ()

## Constructor & Destructor Documentation

xercesc::DOMWriter::DOMWriter | ( |  | ) | `[inline, protected]`

virtual xercesc::DOMWriter::~DOMWriter | ( |  | ) | `[inline, virtual]`

| Destructor.

## Member Function Documentation

virtual bool xercesc::DOMWriter::canSetFeature | ( | const XMLCh *const | featName,
|  | bool | state
| ) | const`[pure virtual]`

Query whether setting a feature to a specific value is supported.

The feature name has the same form as a DOM hasFeature string.

"Experimental - subject to change"

Parameters:

  | featName | The feature name, which is a DOM has-feature style string.
  | state | The requested state of the feature (`true` or `false`).

Returns:
  `true` if the feature could be successfully set to the specified value, or `false` if the feature is not recognized or the requested value is not supported. The value of the feature itself is not changed.

Since:
  DOM Level 3

virtual const XMLCh* xercesc::DOMWriter::getEncoding | ( |  | ) | const`[pure virtual]`

Return the character encoding in which the output will be written.

"Experimental - subject to change"

Returns:
  The character encoding used.

See also:
  setEncoding

Since:
  DOM Level 3

virtual DOMErrorHandler* xercesc::DOMWriter::getErrorHandler | ( |  | ) | const`[pure virtual]`

Return the error handler that will receive error notifications during serialization.

"Experimental - subject to change"

Returns:
  The error handler to be used.

See also:
  setErrorHandler

Since:
  DOM Level 3

virtual bool xercesc::DOMWriter::getFeature | ( | const XMLCh *const | featName | ) | const`[pure virtual]`

Look up the value of a feature.

The feature name has the same form as a DOM hasFeature string

Parameters:

  | featName | The feature name, which is a string with DOM has-feature syntax.

Returns:
  The current state of the feature (`true` or `false`).

Exceptions:

  | DOMException | Raise a NOT_FOUND_ERR When the `DOMWriter` does not recognize the feature name.

"Experimental - subject to change"

See also:
  setFeature

Since:
  DOM Level 3

virtual DOMWriterFilter* xercesc::DOMWriter::getFilter | ( |  | ) | const`[pure virtual]`

Return the WriterFilter used.

"Experimental - subject to change"

Returns:
  The writer filter used.

See also:
  setFilter

Since:
  DOM Level 3

virtual const XMLCh* xercesc::DOMWriter::getNewLine | ( |  | ) | const`[pure virtual]`

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

"Experimental - subject to change"

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

See also:
  setNewLine

Since:
  DOM Level 3

virtual void xercesc::DOMWriter::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::DOMWriter::setEncoding | ( | const XMLCh *const | encoding | ) | `[pure virtual]`

The character encoding in which the output will be written.

The encoding to use when writing is determined as follows: If the encoding attribute has been set, that value will be used.If the encoding attribute is `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.
The default value is `null`.

"Experimental - subject to change"

Parameters:

  | encoding | The character encoding in which the output will be written.

See also:
  getEncoding

Since:
  DOM Level 3

virtual void xercesc::DOMWriter::setErrorHandler | ( | DOMErrorHandler * | errorHandler | ) | `[pure virtual]`

The error handler that will receive error notifications during serialization.

The node where the error occured is passed to this error handler, any modification to nodes from within an error callback should be avoided since this will result in undefined, implementation dependent behavior.

"Experimental - subject to change"

Parameters:

  | errorHandler | The error handler to be used.

See also:
  getErrorHandler

Since:
  DOM Level 3

virtual void xercesc::DOMWriter::setFeature | ( | const XMLCh *const | featName,
|  | bool | state
| ) | `[pure virtual]`

Set the state of a feature.

The feature name has the same form as a DOM hasFeature string.
It is possible for a `DOMWriter` to recognize a feature name but to be unable to set its value.

"Experimental - subject to change"

Parameters:

  | featName | The feature name.
  | state | The requested state of the feature (`true` or `false`).

Exceptions:

  | DOMException | Raise a NOT_SUPPORTED_ERR exception when the `DOMWriter` recognizes the feature name but cannot set the requested value. Raise a NOT_FOUND_ERR When the `DOMWriter` does not recognize the feature name.

See also:
  getFeature

Since:
  DOM Level 3

virtual void xercesc::DOMWriter::setFilter | ( | DOMWriterFilter * | 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.

"Experimental - subject to change"

Parameters:

  | filter | The writer filter to be used.

See also:
  getFilter

Since:
  DOM Level 3

virtual void xercesc::DOMWriter::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".
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`.

"Experimental - subject to change"

Parameters:

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

See also:
  getNewLine

Since:
  DOM Level 3

virtual bool xercesc::DOMWriter::writeNode | ( | XMLFormatTarget *const | destination,
|  | const DOMNode & | nodeToWrite
| ) | `[pure virtual]`

Write out the specified node as described above in the description of `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.

"Experimental - subject to change"

Parameters:

  | destination | The destination for the data to be written.
  | 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.

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

virtual XMLCh* xercesc::DOMWriter::writeToString | ( | const DOMNode & | nodeToWrite | ) | `[pure virtual]`

Serialize the specified node as described above in the description of `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.

"Experimental - subject to change"

Parameters:

  | nodeToWrite | The node to be written.

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 DOMWriter is ignored in writeToString().

Since:
  DOM Level 3

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

- DOMWriter.hpp