Forces the IMXWriter to skip the XML declaration. This can be useful when you want to output fragments of larger XML documents that can be assembled into a single XML document later.
Property Let IMXWriter_omitXMLDeclaration(ByVal RHS As Boolean) Property Get IMXWriter_omitXMLDeclaration() As Boolean
oMXXMLWriter.omitXMLDeclaration= boolValue boolValue = oMXXMLWriter.omitXMLDeclaration
Read/write. A Boolean expression (True/False) specifying whether the feature is on or off. The omitXMLDeclaration property has no effect on DOM output.
[propput] HRESULT omitXMLDeclaration ( [in] VARIANT_BOOL fValue);
[propget] HRESULT omitXMLDeclaration ( [out, retval] VARIANT_BOOL * fValue);
| Value | Description |
|---|---|
| True | Omit XML declaration. |
| False (default) | Provide XML declaration. |
The omitXMLDeclaration property has no effect on DOM output.
The IXSLProcessor object implements the omitXMLDeclaration property as follows:
<?xml version="1.0"?> appears in processor output.The following example loads the books.xml file and generates an XML document without the XML declaration.
XML File
Use books.xml.
Visual Basic File (Form1.frm)
Private Sub Command1_Click()
Dim rdr As New Msxml2.SAXXMLReader50
Dim cnth As IVBSAXContentHandler
Dim wrt As New MXXMLWriter50
wrt.indent = True
wrt.omitXMLDeclaration = True
wrt.byteOrderMark = False
Set cnth = wrt
Set rdr.contentHandler = cnth
rdr.parseURL ("books.xml")
MsgBox wrt.output
End Sub
Try It!
Output
When run, the sample Visual Basic application should display the books.xml with the XML declaration omitted from the output.
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 | Sample XML File (books.xml)
Applies to: IMXWriter Interface