Use MXXMLWriter

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - SAX2 Developer's Guide

Use MXXMLWriter

An MXXMLWriter object provides an efficient and flexible way to handle the output produced by the latest version of the Simple API for XML (SAX2) events. For example, an MXXMLWriter object:

  • Automatically handles the details of building an XML document or document fragment. When connected to SAXXMLReader, MXXMLWriter accumulates data passed by events thrown by the reader and stores the data in an output string. Also, MXXMLWriter can automatically handle the details of inserting special characters, such as the "<" character at the beginning of an element.
  • Enables you to format output by providing properties, such as omitXMLDeclaration, indent, and encoding, that apply to the document output.
  • Enables you to manually build an XML document by invoking the methods of the IVBSAXContentHandler, IVBSAXDTDHandler, IVBSAXDeclHandler, IVBSAXErrorHandler, and IVBSAXLexicalHandler interfaces.
  • Implements the IMXWriter interface, which is a complementary application programming interface (API) to the latest version of the Simple API for XML (SAX2) implementation of Microsoft® XML Core Services (MSXML) 5.0 for Microsoft Office.

MSXML provides two CoClasses that implement IMXWriter: MXXMLWriter, which generates XML or DOM output and MXHTMLWriter, which generates HTML output.

To help you understand how you can incorporate MXXMLWriter into your applications, this section provides the following topics:

Although this tutorial covers the code included in the sample application, it is recommended that you download the sample MXXMLWriter application from the MSDN Code Center.

Other Resources Other Resources

Sample MXXMLWriter application