Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

The IMXWriterinterface is a complementary application programming interface (API) to the latest version of the Simple API for XML (SAX2) implementation of the Microsoft® XML Parser (MSXML). It is implemented by the following coclasses:

  • MXXMLWriter(version-independent)

  • MXXMLWriter30(version-dependent)

When implemented, MXXMLWriterautomatically handles the details of building an XML document or document fragment. For example, when connected to SAXXMLReader, MXXMLWriteraccumulates data passed by events thrown by the reader and stores the data in an output string. MXXMLWriteralso automatically handles the details of inserting special characters, such as the less than character (<) at the beginning of an element.

In addition, MXXMLWriterenables you to perform the following tasks:

  • Control the output of a document by setting such properties as omitXMLDeclaration, indent, and encoding.

  • Manually build an XML document by invoking methods of the ISAXContentHandler, ISAXDTDHandler, ISAXDeclHandler, and ISAXLexicalHandlerinterfaces.

Important:
The IMXWriterinterface implements the ISAXContentHandler, ISAXDTDHandler, ISAXErrorHandler, ISAXDeclHandler, and ISAXLexicalHandlerinterfaces. However, to enable MXXMLWriterto catch handler events passed by SAXXMLReader, you must register MXXMLWriteras the content handler, and optionally as any of the other handlers.

Ideally, MXXMLWriterconnected to SAXXMLReaderproduces the same document as provided on the input. However, MXXMLWritermight miss content deemed ignorable by XML 1.0 specifications or may output in a different encoding. For example, national encoding can be replaced with Unicode Transformation Format (UTF-8 or UTF-16). Replacing the encoding becomes useful if you use a custom SAXXMLFilterbetween SAXXMLReaderand MXXMLWriter. Thus, you are able to perform powerful conversions on XML documents without forfeiting performance, as in the case of the Document Object Model (DOM).

The MXXMLWriterand MXXMLWriter30coclasses output XML and match the method="xml"attribute of the XSL Transformations (XSLT) xsl:outputelement.

MXXMLWriteruses the generous input approach, which means it outputs what is entered. The application ensures that SAX events and parameters match those of a well-formed or valid XML document.

MXXMLWriterresets the internal state on the startDocumentevent of the ISAXContentHandler/IVBSAXContentHandlerinterface.

The following table shows the methods for this interface.

Method Description

flush Method

This method flushes the object's internal buffer to its destination IStream/ String.

The following table shows the properties for this interface.

Property Description

byteOrderMark Property

Determines whether or not to write the Byte Order Mark (BOM).

disableOutputEscaping Property

Matches the disable-output-escapingattribute of <xsl:text>and <xsl:value-of>elements.

encoding Property

Sets encoding for the output.

indent Property

Sets whether or not to indent output.

omitXMLDeclaration Property

Forces the MXXMLWriterto skip the XML declaration.

output Property (XML SAX)

Determines the output for the MXXMLWriter.

standalone Property

Causes the MXXMLWriterto include the standaloneattribute in the XML header.

version Property

Specifies the version to include in XML declarations.

Requirements

Header msxml2.h, msxml2.idl
Library uuid.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

XML SAX Interfaces