Sets the destination and the type of output for IMXWriter
. By default, the output
property is a BSTR (string) value. Output can be:
IStream
interface. (The resulting document will be written into the provided IStream
).DOMDocument
object.
For more information about setting the output
property to a DOMDocument
object, see Create a DOMDocument Object from SAX Events.
Setting this property to the empty value (VT_EMPTY or " ") will return output to the internal string and reset it.
Private Property Let IMXWriter_output(ByVal RHS As Variant) Private Property Get IMXWriter_output() As Variant
oMXXMLWriter.output = varDestination varDestination = oMXXMLWriter.output
Read/write. Variant destination.
The following example creates an instance of MXXMLWriter
and sets it to the ContentHandler
. Method calls on the ContentHandler
are used to manually generate a document. In the sample, a DOMDocument
object is created, and the writer output is set to the DOMDocument
object. After the contents of the output
property are loaded into a DOMDocument
object, they are then displayed in message box.
XML File
Use books.xml.
Visual Basic File (Form1.frm)
Private Sub Command1_Click() Dim wrt As New MXXMLWriter50 Dim cnth As IVBSAXContentHandler Dim atrs As New SAXAttributes50 Dim xmlDoc As New DOMDocument50 Dim currNode As IXMLDOMNode Set cnth = wrt wrt.output = xmlDoc cnth.startDocument cnth.startElement "", "", "catalog", atrs atrs.addAttribute "", "", "id", "CDATA", "bk101" cnth.startElement "", "", "book", atrs atrs.Clear cnth.startElement "", "", "author", atrs cnth.characters "Gambardella, Matthew" cnth.endElement "", "", "author" cnth.startElement "", "", "title", atrs cnth.characters "XML Developer's Guide" cnth.endElement "", "", "title" cnth.startElement "", "", "description", atrs cnth.characters "An in-depth look at creating applications with XML" cnth.endElement "", "", "description" cnth.endElement "", "", "book" cnth.endElement "", "", "catalog" 'Ends the document. cnth.endDocument Set currNode = xmlDoc.documentElement MsgBox currNode.xml End Sub
Try It!
Output
When run, the sample Visual Basic application should display in a message box the contents of the XML document element (the <catalog>
element and all its node children) that was created using SAX ContentHandler
method calls.
The output text should be this:
<catalog><book id="bk101"><author>Gambardella, Matthew</author><title>XML Developer's Guide</title><description>An in-depth look at creating applications with XML</description></book></catalog>
[propput] HRESULT output ( [in] VARIANT varDestination);
[propget] HRESULT output ( [out, retval] VARIANT * varDestination);
The default is VT_EMPTY to output to string.
To view reference information for Visual Basic or C/C++ only, click the Language Filter button in the upper-left corner of the page.
MXHTMLWriter CoClass | MXXMLWriter CoClass
Applies to: IMXWriter Interface