IMXWriter Interface

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - SAX2 Reference

IMXWriter Interface

The IMXWriter interface 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.

CoClass Description
MXXMLWriter Generates XML or DOM output.
MXHTMLWriter Generates HTML output.

The following can be set as output for IMXWriter:

  • Any implementation of the IStream interface. (The resulting document will be written into the provided IStream.)
  • A string.
  • A DOMDocument object.

    For more information about setting the output property to a DOMDocument object, see Create a DOMDocument Object from SAX Events.

IMXWriter also enables you to:

  • control the output of a document by setting properties, such as omitXMLDeclaration, indent, and encoding.
  • generate XML or HTML content 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 the writer to catch handler events passed by SAXXMLReader, you must set the writer as the ContentHandler, and, optionally, as any of the other handlers. For more information about how to set a writer as a handler, see Use MXXMLWriter.

Ideally, a writer connected to SAXXMLReader produces the same document as provided on the input. However, the writer may 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 the writer.

IMXWriter uses the generous input approach, which means it outputs what is entered. It is the responsibility of the application to ensure that SAX events and parameters match those of a well-formed or valid XML document.

Properties

byteOrderMark Determines whether to write the Byte Order Mark (BOM). The byteOrderMark property has no effect for BSTR or DOM output.
disableOutputEscaping Matches the disable-output-escaping attribute of the <xsl:text> and <xsl:value-of> elements. When set to True, special symbols such as "&" are passed through literally.
encoding Sets and gets encoding for the output.
indent Sets whether to indent output.
omitXMLDeclaration Forces the IMXWriter to skip the XML declaration. Useful for creating document fragments.
output Sets the destination and the type of output for IMXWriter.
standalone Sets the value of the standalone attribute in the XML declaration to "yes" or "no".
version Specifies the version to include in XML declarations.

Methods

In addition to the preceding properties, the following method also applies to the IMXWriter interface.

flush Flushes the object's internal buffer to its destination IStream/string. The flush method has no effect for DOM output.

Versioning

MSXML 3.0 and later

Requirements

[Visual Basic, C/C++]

Implementation: msxml5.dll, msxml2.lib

[C/C++]

Header and LIB files: msxml2.h, msxml2.lib

Version 5.0 Dependent ProgID: msxml2.MXXMLWriter50

Version 4.0 Dependent CLSID: 88d969c8-f192-11d4-a65f-0040963251e5

Version 5.0 Dependent ProgID: msxml2.MXHTMLWriter50

Version 4.0 Dependent CLSID: 88d969c9-f192-11d4-a65f-0040963251e5

To view reference information for Visual Basic or C/C++ only, click the Language Filter button Language Filter in the upper-left corner of the page.