Chapter 12.  XmlEventWriter

#include <DbXml.hpp>

virtual XmlEventWriter::~XmlEventWriter()

The XmlEventWriter class enables applications to construct document content without using serialized XML. This allows use of application-provided parsers and other XML processing mechanisms. The XmlEventWriter is a push-style interface, with content written via explicit interfaces.

The XmlEventWriter maintains state based on information written, and an exception is thrown if an operation is performed that is not valid for the current state. All strings must be null-terminated const unsigned char * values encoded in UTF-8. The values are copied by the underlying implementation, as necessary. When a document is completed, the XmlEventReader::close method must be called to finalize the operation and release resources.

XmlContainer::putDocumentAsEventWriter can be used to obtain an instance of XmlEventWriter that is used to create document content in Berkeley DB XML. XmlEventReaderToWriter can be used to attach an XmlEventReader directly to an XmlEventWriter for copying of content. An XmlEventWriter may also be obtained via an application-written class derived from XmlEventWriter. This object is not thread-safe, and can only be safely used by one thread at a time in an application.

XmlEventWriter Methods