Converts a DOM tree document to the XML text format and writes the data to a String.
xmldoc_object.SaveString(output_string, options)
Prerequisites
None
Parameters
output_string
A required ByRefString variable that receives the XML formatted text output. The string value may be very long.
options
An optional numeric expression that specifies a bit mask of format-related options. The bits in the mask are defined as shown in the table below. If omitted, all option bits are assumed to be 0.
Remarks
This method creates XML text data from a DOM tree and writes it to a String. It throws an exception if any error occurs during conversion. If an error occurs, check the values of xmldoc_object.ErrorCode and xmldoc_object.Message to determine why the conversion failed.
The options parameter is composed of bit flags that are defined in Table 19-123. Bits not shown in the table should be set to 0.
Bit Mask | Name | Description |
---|---|---|
&H01 |
Format |
Format the output by adding new-lines and indenting nested elements. |
&H02 |
Suppress declarations |
Suppress output of the standard XML declarations comments at the start of the output. |
&H04 |
Suppress empty tags |
Suppress output of empty sections. |
Examples
Dim doc As XmlDoc
Dim ss As String
doc = New XmlDoc("My_doc")
. . .
doc.SaveString(ss)
Console.Writeline(ss)
See Also
XML Classes | xmldoc_object.ErrorCode | XmlDoc.LoadString | xmldoc_object.Message | xmldoc_object.SaveFile