IMXWriter (Windows Embedded CE 6.0)
1/6/2010
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 |
---|---|
This method flushes the object's internal buffer to its destination IStream/String. |
The following table shows the properties for this interface.
Property | Description |
---|---|
Determines whether or not to write the Byte Order Mark (BOM). |
|
Matches the disable-output-escaping attribute of <xsl:text> and <xsl:value-of> elements. |
|
Sets encoding for the output. |
|
Sets whether or not to indent output. |
|
Forces the MXXMLWriter to skip the XML declaration. |
|
Determines the output for the MXXMLWriter. |
|
Causes the MXXMLWriter to include the standalone attribute in the XML header. |
|
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 |