Compartilhar via


Configuring MXXMLWriter Output

 

MXXMLWriter provides properties that you can set to control its output, including encoding, indent, omitXMLDeclaration, and output.

For example, the sample MXXMLWriter application creates a document fragment from an XML document. It does this by the way it sets the omitXMLDeclaration property. When you set this property to True (as shown in bold in the following code sample), MXXMLWriter strips the XML declaration from an XML document before placing the document in the internal output buffer.

Private Sub CommandTryFile_Click()
    ' Set parameters, clean the scene.
    TextSource.Text = ""
    wrt.output = ""
    wrt.omitXMLDeclaration = True
    On Error GoTo uhoh
    rdr.parseURL TextFileName.Text
    
    TextResult.Text = wrt.output
    Exit Sub

The following table shows how setting the omitXMLDeclaration property to True removes the XML declaration from a document.

wrt.omitXMLDeclaration = False wrt.omitXMLDeclaration = True
<?xml version="1.0" encoding="UTF-16" standalone="no"?>

 <root aaa="microsoft.com">

 <PARTS>

 </root>
<root aaa="microsoft.com">

 <PARTS>

 </root>

There are other ways that you can configure your MXXMLWriter object to control its output. For more information about the properties you can set for MXXMLWriter, see the IMXWriter Interface.

See Also

Manually Building an XML Document with MXXMLWriter