次の方法で共有


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). 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 writeras 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 writerconnected 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.

Requirements

Implementation:

msxml3.dll, msxml2.lib (MSXML 3.0)

msxml6.dll, msxml6.lib (MSXML 6.0)

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

Versioning

Implemented in: MSXML 3.0 and later