Writes the XML declaration with the version "1.0" and the standalone attribute.
- standalone
- A bool where true indicates to write "yes" as the value for the standalone attribute, and false indicates to write "no".
Type Reason InvalidOperationException The XmlTextWriter.WriteState is not WriteState.Start.
Note:When System.Xml.XmlTextWriter is instantiated, the XmlTextWriter.WriteState is set to WriteState.Start. All the "write" methods change the XmlTextWriter.WriteState to a value other than Start. Thus, if this method is not the first "write" method called, a InvalidOperationException is thrown.
If XmlTextWriter.WriteStartDocument has been called and then the XmlTextWriter.WriteProcessingInstruction(string, string) method is used to create another XML declaration, a ArgumentException will be thrown.
The output of this method with standalone equal to true, an encoding equal to System.Text.Encoding.Unicode, and using the default XmlTextWriter.QuoteChar is:
<?xml version="1.0" encoding="utf-16" standalone="yes"?>
Character encoding is set when the writer is instantiated.
This method overrides XmlWriter.WriteStartDocument.
Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0