Share via


IMXWriter:IDispatch (Windows CE 5.0)

Send Feedback

The IMXWriter interface 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, MXXMLWriter automatically handles the details of building an XML document or document fragment. For example, when connected to SAXXMLReader, MXXMLWriter accumulates data passed by events thrown by the reader and stores the data in an output string. MXXMLWriter also automatically handles the details of inserting special characters, such as the less than character (<) at the beginning of an element.

In addition, MXXMLWriter enables 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 ISAXLexicalHandler interfaces.

**Important   **The IMXWriter interface implements the ISAXContentHandler, ISAXDTDHandler, ISAXErrorHandler, ISAXDeclHandler, and ISAXLexicalHandler interfaces. However, to enable MXXMLWriter to catch handler events passed by SAXXMLReader, you must register MXXMLWriter as the content handler, and optionally as any of the other handlers.

Ideally, MXXMLWriter connected to SAXXMLReader produces the same document as provided on the input. However, MXXMLWriter might 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 SAXXMLFilter between SAXXMLReader and 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 MXXMLWriter and MXXMLWriter30 coclasses output XML and match the method="xml" attribute of the XSL Transformations (XSLT) xsl:output element.

MXXMLWriter uses 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.

MXXMLWriter resets the internal state on the startDocument event of the ISAXContentHandler/IVBSAXContentHandler interface.

The following table shows the methods for this interface.

Method Description
flush 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 This property determines whether or not to write the Byte Order Mark (BOM).
disableOutputEscaping This property matches the disable-output-escaping attribute of <xsl:text> and <xsl:value-of> elements.
encoding This property sets encoding for the output.
indent This property sets whether or not to indent output.
omitXMLDeclaration This property forces the MXXMLWriter to skip the XML declaration.
output This property determines the output for the MXXMLWriter.
standalone This property causes the MXXMLWriter to include the standalone attribute in the XML header.
version This property specifies the version to include in XML declarations.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Msxml2.h, Msxml2.idl.
Link Library: Uuid.lib.

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.