mscorlib(4.0.0.0) API with additions
System.Xml.XmlWriter Class Referenceabstract

Represents a writer that provides a fast, non-cached, forward-only way to generate streams or files that contain XML data. More...

Inheritance diagram for System.Xml.XmlWriter:
[legend]
Collaboration diagram for System.Xml.XmlWriter:
[legend]

Public Member Functions

abstract void WriteStartDocument ()
 When overridden in a derived class, writes the XML declaration with the version "1.0". More...
 
abstract void WriteStartDocument (bool standalone)
 When overridden in a derived class, writes the XML declaration with the version "1.0" and the standalone attribute. More...
 
abstract void WriteEndDocument ()
 When overridden in a derived class, closes any open elements or attributes and puts the writer back in the Start state. More...
 
abstract void WriteDocType (string name, string pubid, string sysid, string subset)
 When overridden in a derived class, writes the DOCTYPE declaration with the specified name and optional attributes. More...
 
void WriteStartElement (string localName, string ns)
 When overridden in a derived class, writes the specified start tag and associates it with the given namespace. More...
 
abstract void WriteStartElement (string prefix, string localName, string ns)
 When overridden in a derived class, writes the specified start tag and associates it with the given namespace and prefix. More...
 
void WriteStartElement (string localName)
 When overridden in a derived class, writes out a start tag with the specified local name. More...
 
abstract void WriteEndElement ()
 When overridden in a derived class, closes one element and pops the corresponding namespace scope. More...
 
abstract void WriteFullEndElement ()
 When overridden in a derived class, closes one element and pops the corresponding namespace scope. More...
 
void WriteAttributeString (string localName, string ns, string value)
 When overridden in a derived class, writes an attribute with the specified local name, namespace URI, and value. More...
 
void WriteAttributeString (string localName, string value)
 When overridden in a derived class, writes out the attribute with the specified local name and value. More...
 
void WriteAttributeString (string prefix, string localName, string ns, string value)
 When overridden in a derived class, writes out the attribute with the specified prefix, local name, namespace URI, and value. More...
 
void WriteStartAttribute (string localName, string ns)
 Writes the start of an attribute with the specified local name and namespace URI. More...
 
abstract void WriteStartAttribute (string prefix, string localName, string ns)
 When overridden in a derived class, writes the start of an attribute with the specified prefix, local name, and namespace URI. More...
 
void WriteStartAttribute (string localName)
 Writes the start of an attribute with the specified local name. More...
 
abstract void WriteEndAttribute ()
 When overridden in a derived class, closes the previous M:System.Xml.XmlWriter.WriteStartAttribute(System.String,System.String) call. More...
 
abstract void WriteCData (string text)
 When overridden in a derived class, writes out a <![CDATA[...]]> block containing the specified text. More...
 
abstract void WriteComment (string text)
 When overridden in a derived class, writes out a comment <!–...–> containing the specified text. More...
 
abstract void WriteProcessingInstruction (string name, string text)
 When overridden in a derived class, writes out a processing instruction with a space between the name and text as follows: <?name text?>. More...
 
abstract void WriteEntityRef (string name)
 When overridden in a derived class, writes out an entity reference as &amp;name;. More...
 
abstract void WriteCharEntity (char ch)
 When overridden in a derived class, forces the generation of a character entity for the specified Unicode character value. More...
 
abstract void WriteWhitespace (string ws)
 When overridden in a derived class, writes out the given white space. More...
 
abstract void WriteString (string text)
 When overridden in a derived class, writes the given text content. More...
 
abstract void WriteSurrogateCharEntity (char lowChar, char highChar)
 When overridden in a derived class, generates and writes the surrogate character entity for the surrogate character pair. More...
 
abstract void WriteChars (char[] buffer, int index, int count)
 When overridden in a derived class, writes text one buffer at a time. More...
 
abstract void WriteRaw (char[] buffer, int index, int count)
 When overridden in a derived class, writes raw markup manually from a character buffer. More...
 
abstract void WriteRaw (string data)
 When overridden in a derived class, writes raw markup manually from a string. More...
 
abstract void WriteBase64 (byte[] buffer, int index, int count)
 When overridden in a derived class, encodes the specified binary bytes as Base64 and writes out the resulting text. More...
 
virtual void WriteBinHex (byte[] buffer, int index, int count)
 When overridden in a derived class, encodes the specified binary bytes as BinHex and writes out the resulting text. More...
 
virtual void Close ()
 When overridden in a derived class, closes this stream and the underlying stream. More...
 
abstract void Flush ()
 When overridden in a derived class, flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. More...
 
abstract string LookupPrefix (string ns)
 When overridden in a derived class, returns the closest prefix defined in the current namespace scope for the namespace URI. More...
 
virtual void WriteNmToken (string name)
 When overridden in a derived class, writes out the specified name, ensuring it is a valid NmToken according to the W3C XML 1.0 recommendation (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name). More...
 
virtual void WriteName (string name)
 When overridden in a derived class, writes out the specified name, ensuring it is a valid name according to the W3C XML 1.0 recommendation (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name). More...
 
virtual void WriteQualifiedName (string localName, string ns)
 When overridden in a derived class, writes out the namespace-qualified name. This method looks up the prefix that is in scope for the given namespace. More...
 
virtual void WriteValue (object value)
 Writes the object value. More...
 
virtual void WriteValue (string value)
 Writes a T:System.String value. More...
 
virtual void WriteValue (bool value)
 Writes a T:System.Boolean value. More...
 
virtual void WriteValue (DateTime value)
 Writes a T:System.DateTime value. More...
 
virtual void WriteValue (DateTimeOffset value)
 Writes a T:System.DateTimeOffset value. More...
 
virtual void WriteValue (double value)
 Writes a T:System.Double value. More...
 
virtual void WriteValue (float value)
 Writes a single-precision floating-point number. More...
 
virtual void WriteValue (decimal value)
 Writes a T:System.Decimal value. More...
 
virtual void WriteValue (int value)
 Writes a T:System.Int32 value. More...
 
virtual void WriteValue (long value)
 Writes a T:System.Int64 value. More...
 
virtual void WriteAttributes (XmlReader reader, bool defattr)
 When overridden in a derived class, writes out all the attributes found at the current position in the T:System.Xml.XmlReader. More...
 
virtual void WriteNode (XmlReader reader, bool defattr)
 When overridden in a derived class, copies everything from the reader to the writer and moves the reader to the start of the next sibling. More...
 
virtual void WriteNode (XPathNavigator navigator, bool defattr)
 Copies everything from the T:System.Xml.XPath.XPathNavigator object to the writer. The position of the T:System.Xml.XPath.XPathNavigator remains unchanged. More...
 
void WriteElementString (string localName, string value)
 Writes an element with the specified local name and value. More...
 
void WriteElementString (string localName, string ns, string value)
 Writes an element with the specified local name, namespace URI, and value. More...
 
void WriteElementString (string prefix, string localName, string ns, string value)
 Writes an element with the specified prefix, local name, namespace URI, and value. More...
 
void Dispose ()
 Releases all resources used by the current instance of the T:System.Xml.XmlWriter class. More...
 
virtual Task WriteStartDocumentAsync ()
 Asynchronously writes the XML declaration with the version "1.0". More...
 
virtual Task WriteStartDocumentAsync (bool standalone)
 Asynchronously writes the XML declaration with the version "1.0" and the standalone attribute. More...
 
virtual Task WriteEndDocumentAsync ()
 Asynchronously closes any open elements or attributes and puts the writer back in the Start state. More...
 
virtual Task WriteDocTypeAsync (string name, string pubid, string sysid, string subset)
 Asynchronously writes the DOCTYPE declaration with the specified name and optional attributes. More...
 
virtual Task WriteStartElementAsync (string prefix, string localName, string ns)
 Asynchronously writes the specified start tag and associates it with the given namespace and prefix. More...
 
virtual Task WriteEndElementAsync ()
 Asynchronously closes one element and pops the corresponding namespace scope. More...
 
virtual Task WriteFullEndElementAsync ()
 Asynchronously closes one element and pops the corresponding namespace scope. More...
 
Task WriteAttributeStringAsync (string prefix, string localName, string ns, string value)
 Asynchronously writes out the attribute with the specified prefix, local name, namespace URI, and value. More...
 
virtual Task WriteCDataAsync (string text)
 Asynchronously writes out a <![CDATA[...]]> block containing the specified text. More...
 
virtual Task WriteCommentAsync (string text)
 Asynchronously writes out a comment <!–...–> containing the specified text. More...
 
virtual Task WriteProcessingInstructionAsync (string name, string text)
 Asynchronously writes out a processing instruction with a space between the name and text as follows: <?name text?>. More...
 
virtual Task WriteEntityRefAsync (string name)
 Asynchronously writes out an entity reference as &amp;name;. More...
 
virtual Task WriteCharEntityAsync (char ch)
 Asynchronously forces the generation of a character entity for the specified Unicode character value. More...
 
virtual Task WriteWhitespaceAsync (string ws)
 Asynchronously writes out the given white space. More...
 
virtual Task WriteStringAsync (string text)
 Asynchronously writes the given text content. More...
 
virtual Task WriteSurrogateCharEntityAsync (char lowChar, char highChar)
 Asynchronously generates and writes the surrogate character entity for the surrogate character pair. More...
 
virtual Task WriteCharsAsync (char[] buffer, int index, int count)
 Asynchronously writes text one buffer at a time. More...
 
virtual Task WriteRawAsync (char[] buffer, int index, int count)
 Asynchronously writes raw markup manually from a character buffer. More...
 
virtual Task WriteRawAsync (string data)
 Asynchronously writes raw markup manually from a string. More...
 
virtual Task WriteBase64Async (byte[] buffer, int index, int count)
 Asynchronously encodes the specified binary bytes as Base64 and writes out the resulting text. More...
 
virtual Task WriteBinHexAsync (byte[] buffer, int index, int count)
 Asynchronously encodes the specified binary bytes as BinHex and writes out the resulting text. More...
 
virtual Task FlushAsync ()
 Asynchronously flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. More...
 
virtual Task WriteNmTokenAsync (string name)
 Asynchronously writes out the specified name, ensuring it is a valid NmToken according to the W3C XML 1.0 recommendation (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name). More...
 
virtual Task WriteNameAsync (string name)
 Asynchronously writes out the specified name, ensuring it is a valid name according to the W3C XML 1.0 recommendation (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name). More...
 
virtual async Task WriteQualifiedNameAsync (string localName, string ns)
 Asynchronously writes out the namespace-qualified name. This method looks up the prefix that is in scope for the given namespace. More...
 
virtual async Task WriteAttributesAsync (XmlReader reader, bool defattr)
 Asynchronously writes out all the attributes found at the current position in the T:System.Xml.XmlReader. More...
 
virtual Task WriteNodeAsync (XmlReader reader, bool defattr)
 Asynchronously copies everything from the reader to the writer and moves the reader to the start of the next sibling. More...
 
virtual async Task WriteNodeAsync (XPathNavigator navigator, bool defattr)
 Asynchronously copies everything from the T:System.Xml.XPath.XPathNavigator object to the writer. The position of the T:System.Xml.XPath.XPathNavigator remains unchanged. More...
 
async Task WriteElementStringAsync (string prefix, string localName, string ns, string value)
 Asynchronously writes an element with the specified prefix, local name, namespace URI, and value. More...
 

Static Public Member Functions

static XmlWriter Create (string outputFileName)
 Creates a new T:System.Xml.XmlWriter instance using the specified filename. More...
 
static XmlWriter Create (string outputFileName, XmlWriterSettings settings)
 Creates a new T:System.Xml.XmlWriter instance using the filename and T:System.Xml.XmlWriterSettings object. More...
 
static XmlWriter Create (Stream output)
 Creates a new T:System.Xml.XmlWriter instance using the specified stream. More...
 
static XmlWriter Create (Stream output, XmlWriterSettings settings)
 Creates a new T:System.Xml.XmlWriter instance using the stream and T:System.Xml.XmlWriterSettings object. More...
 
static XmlWriter Create (TextWriter output)
 Creates a new T:System.Xml.XmlWriter instance using the specified T:System.IO.TextWriter. More...
 
static XmlWriter Create (TextWriter output, XmlWriterSettings settings)
 Creates a new T:System.Xml.XmlWriter instance using the T:System.IO.TextWriter and T:System.Xml.XmlWriterSettings objects. More...
 
static XmlWriter Create (StringBuilder output)
 Creates a new T:System.Xml.XmlWriter instance using the specified T:System.Text.StringBuilder. More...
 
static XmlWriter Create (StringBuilder output, XmlWriterSettings settings)
 Creates a new T:System.Xml.XmlWriter instance using the T:System.Text.StringBuilder and T:System.Xml.XmlWriterSettings objects. More...
 
static XmlWriter Create (XmlWriter output)
 Creates a new T:System.Xml.XmlWriter instance using the specified T:System.Xml.XmlWriter object. More...
 
static XmlWriter Create (XmlWriter output, XmlWriterSettings settings)
 Creates a new T:System.Xml.XmlWriter instance using the specified T:System.Xml.XmlWriter and T:System.Xml.XmlWriterSettings objects. More...
 

Protected Member Functions

virtual void Dispose (bool disposing)
 Releases the unmanaged resources used by the T:System.Xml.XmlWriter and optionally releases the managed resources. More...
 
virtual internal Task WriteStartAttributeAsync (string prefix, string localName, string ns)
 Asynchronously writes the start of an attribute with the specified prefix, local name, and namespace URI. More...
 
virtual internal Task WriteEndAttributeAsync ()
 Asynchronously closes the previous M:System.Xml.XmlWriter.WriteStartAttribute(System.String,System.String) call. More...
 
 XmlWriter ()
 Initializes a new instance of the T:System.Xml.XmlWriter class. More...
 

Properties

virtual XmlWriterSettings Settings [get]
 Gets the T:System.Xml.XmlWriterSettings object used to create this T:System.Xml.XmlWriter instance. More...
 
abstract WriteState WriteState [get]
 When overridden in a derived class, gets the state of the writer. More...
 
virtual XmlSpace XmlSpace [get]
 When overridden in a derived class, gets an T:System.Xml.XmlSpace representing the current xml:space scope. More...
 
virtual string XmlLang [get]
 When overridden in a derived class, gets the current xml:lang scope. More...
 

Detailed Description

Represents a writer that provides a fast, non-cached, forward-only way to generate streams or files that contain XML data.

Definition at line 12 of file XmlWriter.cs.

Constructor & Destructor Documentation

◆ XmlWriter()

System.Xml.XmlWriter.XmlWriter ( )
protected

Initializes a new instance of the T:System.Xml.XmlWriter class.

Definition at line 1649 of file XmlWriter.cs.

Member Function Documentation

◆ Close()

virtual void System.Xml.XmlWriter.Close ( )
virtual

When overridden in a derived class, closes this stream and the underlying stream.

Exceptions
T:System.InvalidOperationExceptionA call is made to write more output after Close has been called or the result of this call is an invalid XML document.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 353 of file XmlWriter.cs.

◆ Create() [1/10]

static XmlWriter System.Xml.XmlWriter.Create ( string  outputFileName)
static

Creates a new T:System.Xml.XmlWriter instance using the specified filename.

Parameters
outputFileNameThe file to which you want to write. The T:System.Xml.XmlWriter creates a file at the specified path and writes to it in XML 1.0 text syntax. The outputFileName must be a file system path.
Returns
An T:System.Xml.XmlWriter object.
Exceptions
T:System.ArgumentNullExceptionThe url value is null.

Definition at line 854 of file XmlWriter.cs.

◆ Create() [2/10]

static XmlWriter System.Xml.XmlWriter.Create ( string  outputFileName,
XmlWriterSettings  settings 
)
static

Creates a new T:System.Xml.XmlWriter instance using the filename and T:System.Xml.XmlWriterSettings object.

Parameters
outputFileNameThe file to which you want to write. The T:System.Xml.XmlWriter creates a file at the specified path and writes to it in XML 1.0 text syntax. The outputFileName must be a file system path.
settingsThe T:System.Xml.XmlWriterSettings object used to configure the new T:System.Xml.XmlWriter instance. If this is null, a T:System.Xml.XmlWriterSettings with default settings is used.If the T:System.Xml.XmlWriter is being used with the M:System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter) method, you should use the P:System.Xml.Xsl.XslCompiledTransform.OutputSettings property to obtain an T:System.Xml.XmlWriterSettings object with the correct settings. This ensures that the created T:System.Xml.XmlWriter object has the correct output settings.
Returns
An T:System.Xml.XmlWriter object.
Exceptions
T:System.ArgumentNullExceptionThe url value is null.

Definition at line 864 of file XmlWriter.cs.

◆ Create() [3/10]

static XmlWriter System.Xml.XmlWriter.Create ( Stream  output)
static

Creates a new T:System.Xml.XmlWriter instance using the specified stream.

Parameters
outputThe stream to which you want to write. The T:System.Xml.XmlWriter writes XML 1.0 text syntax and appends it to the specified stream.
Returns
An T:System.Xml.XmlWriter object.
Exceptions
T:System.ArgumentNullExceptionThe stream value is null.

Definition at line 878 of file XmlWriter.cs.

◆ Create() [4/10]

static XmlWriter System.Xml.XmlWriter.Create ( Stream  output,
XmlWriterSettings  settings 
)
static

Creates a new T:System.Xml.XmlWriter instance using the stream and T:System.Xml.XmlWriterSettings object.

Parameters
outputThe stream to which you want to write. The T:System.Xml.XmlWriter writes XML 1.0 text syntax and appends it to the specified stream.
settingsThe T:System.Xml.XmlWriterSettings object used to configure the new T:System.Xml.XmlWriter instance. If this is null, a T:System.Xml.XmlWriterSettings with default settings is used.If the T:System.Xml.XmlWriter is being used with the M:System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter) method, you should use the P:System.Xml.Xsl.XslCompiledTransform.OutputSettings property to obtain an T:System.Xml.XmlWriterSettings object with the correct settings. This ensures that the created T:System.Xml.XmlWriter object has the correct output settings.
Returns
An T:System.Xml.XmlWriter object.
Exceptions
T:System.ArgumentNullExceptionThe stream value is null.

Definition at line 889 of file XmlWriter.cs.

◆ Create() [5/10]

static XmlWriter System.Xml.XmlWriter.Create ( TextWriter  output)
static

Creates a new T:System.Xml.XmlWriter instance using the specified T:System.IO.TextWriter.

Parameters
outputThe T:System.IO.TextWriter to which you want to write. The T:System.Xml.XmlWriter writes XML 1.0 text syntax and appends it to the specified T:System.IO.TextWriter.
Returns
An T:System.Xml.XmlWriter object.
Exceptions
T:System.ArgumentNullExceptionThe text value is null.

Definition at line 903 of file XmlWriter.cs.

◆ Create() [6/10]

static XmlWriter System.Xml.XmlWriter.Create ( TextWriter  output,
XmlWriterSettings  settings 
)
static

Creates a new T:System.Xml.XmlWriter instance using the T:System.IO.TextWriter and T:System.Xml.XmlWriterSettings objects.

Parameters
outputThe T:System.IO.TextWriter to which you want to write. The T:System.Xml.XmlWriter writes XML 1.0 text syntax and appends it to the specified T:System.IO.TextWriter.
settingsThe T:System.Xml.XmlWriterSettings object used to configure the new T:System.Xml.XmlWriter instance. If this is null, a T:System.Xml.XmlWriterSettings with default settings is used.If the T:System.Xml.XmlWriter is being used with the M:System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter) method, you should use the P:System.Xml.Xsl.XslCompiledTransform.OutputSettings property to obtain an T:System.Xml.XmlWriterSettings object with the correct settings. This ensures that the created T:System.Xml.XmlWriter object has the correct output settings.
Returns
An T:System.Xml.XmlWriter object.
Exceptions
T:System.ArgumentNullExceptionThe text value is null.

Definition at line 914 of file XmlWriter.cs.

◆ Create() [7/10]

static XmlWriter System.Xml.XmlWriter.Create ( StringBuilder  output)
static

Creates a new T:System.Xml.XmlWriter instance using the specified T:System.Text.StringBuilder.

Parameters
outputThe T:System.Text.StringBuilder to which to write to. Content written by the T:System.Xml.XmlWriter is appended to the T:System.Text.StringBuilder.
Returns
An T:System.Xml.XmlWriter object.
Exceptions
T:System.ArgumentNullExceptionThe builder value is null.

Definition at line 928 of file XmlWriter.cs.

◆ Create() [8/10]

static XmlWriter System.Xml.XmlWriter.Create ( StringBuilder  output,
XmlWriterSettings  settings 
)
static

Creates a new T:System.Xml.XmlWriter instance using the T:System.Text.StringBuilder and T:System.Xml.XmlWriterSettings objects.

Parameters
outputThe T:System.Text.StringBuilder to which to write to. Content written by the T:System.Xml.XmlWriter is appended to the T:System.Text.StringBuilder.
settingsThe T:System.Xml.XmlWriterSettings object used to configure the new T:System.Xml.XmlWriter instance. If this is null, a T:System.Xml.XmlWriterSettings with default settings is used.If the T:System.Xml.XmlWriter is being used with the M:System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter) method, you should use the P:System.Xml.Xsl.XslCompiledTransform.OutputSettings property to obtain an T:System.Xml.XmlWriterSettings object with the correct settings. This ensures that the created T:System.Xml.XmlWriter object has the correct output settings.
Returns
An T:System.Xml.XmlWriter object.
Exceptions
T:System.ArgumentNullExceptionThe builder value is null.

Definition at line 939 of file XmlWriter.cs.

◆ Create() [9/10]

static XmlWriter System.Xml.XmlWriter.Create ( XmlWriter  output)
static

Creates a new T:System.Xml.XmlWriter instance using the specified T:System.Xml.XmlWriter object.

Parameters
outputThe T:System.Xml.XmlWriter object that you want to use as the underlying writer.
Returns
An T:System.Xml.XmlWriter object that is wrapped around the specified T:System.Xml.XmlWriter object.
Exceptions
T:System.ArgumentNullExceptionThe writer value is null.

Definition at line 957 of file XmlWriter.cs.

◆ Create() [10/10]

static XmlWriter System.Xml.XmlWriter.Create ( XmlWriter  output,
XmlWriterSettings  settings 
)
static

Creates a new T:System.Xml.XmlWriter instance using the specified T:System.Xml.XmlWriter and T:System.Xml.XmlWriterSettings objects.

Parameters
outputThe T:System.Xml.XmlWriter object that you want to use as the underlying writer.
settingsThe T:System.Xml.XmlWriterSettings object used to configure the new T:System.Xml.XmlWriter instance. If this is null, a T:System.Xml.XmlWriterSettings with default settings is used.If the T:System.Xml.XmlWriter is being used with the M:System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter) method, you should use the P:System.Xml.Xsl.XslCompiledTransform.OutputSettings property to obtain an T:System.Xml.XmlWriterSettings object with the correct settings. This ensures that the created T:System.Xml.XmlWriter object has the correct output settings.
Returns
An T:System.Xml.XmlWriter object that is wrapped around the specified T:System.Xml.XmlWriter object.
Exceptions
T:System.ArgumentNullExceptionThe writer value is null.

Definition at line 968 of file XmlWriter.cs.

◆ Dispose() [1/2]

void System.Xml.XmlWriter.Dispose ( )

Releases all resources used by the current instance of the T:System.Xml.XmlWriter class.

Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Implements System.IDisposable.

Definition at line 814 of file XmlWriter.cs.

◆ Dispose() [2/2]

virtual void System.Xml.XmlWriter.Dispose ( bool  disposing)
protectedvirtual

Releases the unmanaged resources used by the T:System.Xml.XmlWriter and optionally releases the managed resources.

Parameters
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 824 of file XmlWriter.cs.

◆ Flush()

abstract void System.Xml.XmlWriter.Flush ( )
pure virtual

When overridden in a derived class, flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.

Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ FlushAsync()

virtual Task System.Xml.XmlWriter.FlushAsync ( )
virtual

Asynchronously flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.

Returns
The task that represents the asynchronous Flush operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1262 of file XmlWriter.cs.

◆ LookupPrefix()

abstract string System.Xml.XmlWriter.LookupPrefix ( string  ns)
pure virtual

When overridden in a derived class, returns the closest prefix defined in the current namespace scope for the namespace URI.

Parameters
nsThe namespace URI whose prefix you want to find.
Returns
The matching prefix or null if no matching namespace URI is found in the current scope.
Exceptions
T:System.ArgumentExceptionns is either null or String.Empty.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteAttributes()

virtual void System.Xml.XmlWriter.WriteAttributes ( XmlReader  reader,
bool  defattr 
)
virtual

When overridden in a derived class, writes out all the attributes found at the current position in the T:System.Xml.XmlReader.

Parameters
readerThe XmlReader from which to copy the attributes.
defattrtrue to copy the default attributes from the XmlReader; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionreader is null.
T:System.Xml.XmlExceptionThe reader is not positioned on an element, attribute or XmlDeclaration node.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 544 of file XmlWriter.cs.

◆ WriteAttributesAsync()

virtual async Task System.Xml.XmlWriter.WriteAttributesAsync ( XmlReader  reader,
bool  defattr 
)
virtual

Asynchronously writes out all the attributes found at the current position in the T:System.Xml.XmlReader.

Parameters
readerThe XmlReader from which to copy the attributes.
defattrtrue to copy the default attributes from the XmlReader; otherwise, false.
Returns
The task that represents the asynchronous WriteAttributes operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1323 of file XmlWriter.cs.

◆ WriteAttributeString() [1/3]

void System.Xml.XmlWriter.WriteAttributeString ( string  localName,
string  ns,
string  value 
)

When overridden in a derived class, writes an attribute with the specified local name, namespace URI, and value.

Parameters
localNameThe local name of the attribute.
nsThe namespace URI to associate with the attribute.
valueThe value of the attribute.
Exceptions
T:System.InvalidOperationExceptionThe state of writer is not WriteState.Element or writer is closed.
T:System.ArgumentExceptionThe xml:space or xml:lang attribute value is invalid.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 155 of file XmlWriter.cs.

◆ WriteAttributeString() [2/3]

void System.Xml.XmlWriter.WriteAttributeString ( string  localName,
string  value 
)

When overridden in a derived class, writes out the attribute with the specified local name and value.

Parameters
localNameThe local name of the attribute.
valueThe value of the attribute.
Exceptions
T:System.InvalidOperationExceptionThe state of writer is not WriteState.Element or writer is closed.
T:System.ArgumentExceptionThe xml:space or xml:lang attribute value is invalid.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 169 of file XmlWriter.cs.

◆ WriteAttributeString() [3/3]

void System.Xml.XmlWriter.WriteAttributeString ( string  prefix,
string  localName,
string  ns,
string  value 
)

When overridden in a derived class, writes out the attribute with the specified prefix, local name, namespace URI, and value.

Parameters
prefixThe namespace prefix of the attribute.
localNameThe local name of the attribute.
nsThe namespace URI of the attribute.
valueThe value of the attribute.
Exceptions
T:System.InvalidOperationExceptionThe state of writer is not WriteState.Element or writer is closed.
T:System.ArgumentExceptionThe xml:space or xml:lang attribute value is invalid.
T:System.Xml.XmlExceptionThe localName or ns is null.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 186 of file XmlWriter.cs.

◆ WriteAttributeStringAsync()

Task System.Xml.XmlWriter.WriteAttributeStringAsync ( string  prefix,
string  localName,
string  ns,
string  value 
)

Asynchronously writes out the attribute with the specified prefix, local name, namespace URI, and value.

Parameters
prefixThe namespace prefix of the attribute.
localNameThe local name of the attribute.
nsThe namespace URI of the attribute.
valueThe value of the attribute.
Returns
The task that represents the asynchronous WriteAttributeString operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1064 of file XmlWriter.cs.

◆ WriteBase64()

abstract void System.Xml.XmlWriter.WriteBase64 ( byte []  buffer,
int  index,
int  count 
)
pure virtual

When overridden in a derived class, encodes the specified binary bytes as Base64 and writes out the resulting text.

Parameters
bufferByte array to encode.
indexThe position in the buffer indicating the start of the bytes to write.
countThe number of bytes to write.
Exceptions
T:System.ArgumentNullExceptionbuffer is null.
T:System.ArgumentOutOfRangeExceptionindex or count is less than zero. -or-The buffer length minus index is less than count .
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteBase64Async()

virtual Task System.Xml.XmlWriter.WriteBase64Async ( byte []  buffer,
int  index,
int  count 
)
virtual

Asynchronously encodes the specified binary bytes as Base64 and writes out the resulting text.

Parameters
bufferByte array to encode.
indexThe position in the buffer indicating the start of the bytes to write.
countThe number of bytes to write.
Returns
The task that represents the asynchronous WriteBase64 operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1239 of file XmlWriter.cs.

◆ WriteBinHex()

virtual void System.Xml.XmlWriter.WriteBinHex ( byte []  buffer,
int  index,
int  count 
)
virtual

When overridden in a derived class, encodes the specified binary bytes as BinHex and writes out the resulting text.

Parameters
bufferByte array to encode.
indexThe position in the buffer indicating the start of the bytes to write.
countThe number of bytes to write.
Exceptions
T:System.ArgumentNullExceptionbuffer is null.
T:System.InvalidOperationExceptionThe writer is closed or in error state.
T:System.ArgumentOutOfRangeExceptionindex or count is less than zero. -or-The buffer length minus index is less than count .
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 345 of file XmlWriter.cs.

◆ WriteBinHexAsync()

virtual Task System.Xml.XmlWriter.WriteBinHexAsync ( byte []  buffer,
int  index,
int  count 
)
virtual

Asynchronously encodes the specified binary bytes as BinHex and writes out the resulting text.

Parameters
bufferByte array to encode.
indexThe position in the buffer indicating the start of the bytes to write.
countThe number of bytes to write.
Returns
The task that represents the asynchronous WriteBinHex operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1252 of file XmlWriter.cs.

◆ WriteCData()

abstract void System.Xml.XmlWriter.WriteCData ( string  text)
pure virtual

When overridden in a derived class, writes out a <![CDATA[...]]> block containing the specified text.

Parameters
textThe text to place inside the CDATA block.
Exceptions
T:System.ArgumentExceptionThe text would result in a non-well formed XML document.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteCDataAsync()

virtual Task System.Xml.XmlWriter.WriteCDataAsync ( string  text)
virtual

Asynchronously writes out a <![CDATA[...]]> block containing the specified text.

Parameters
textThe text to place inside the CDATA block.
Returns
The task that represents the asynchronous WriteCData operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1110 of file XmlWriter.cs.

◆ WriteCharEntity()

abstract void System.Xml.XmlWriter.WriteCharEntity ( char  ch)
pure virtual

When overridden in a derived class, forces the generation of a character entity for the specified Unicode character value.

Parameters
chThe Unicode character for which to generate a character entity.
Exceptions
T:System.ArgumentExceptionThe character is in the surrogate pair character range, 0xd800 - 0xdfff.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteCharEntityAsync()

virtual Task System.Xml.XmlWriter.WriteCharEntityAsync ( char  ch)
virtual

Asynchronously forces the generation of a character entity for the specified Unicode character value.

Parameters
chThe Unicode character for which to generate a character entity.
Returns
The task that represents the asynchronous WriteCharEntity operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1155 of file XmlWriter.cs.

◆ WriteChars()

abstract void System.Xml.XmlWriter.WriteChars ( char []  buffer,
int  index,
int  count 
)
pure virtual

When overridden in a derived class, writes text one buffer at a time.

Parameters
bufferCharacter array containing the text to write.
indexThe position in the buffer indicating the start of the text to write.
countThe number of characters to write.
Exceptions
T:System.ArgumentNullExceptionbuffer is null.
T:System.ArgumentOutOfRangeExceptionindex or count is less than zero.-or-The buffer length minus index is less than count ; the call results in surrogate pair characters being split or an invalid surrogate pair being written.
T:System.ArgumentExceptionThe buffer parameter value is not valid.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteCharsAsync()

virtual Task System.Xml.XmlWriter.WriteCharsAsync ( char []  buffer,
int  index,
int  count 
)
virtual

Asynchronously writes text one buffer at a time.

Parameters
bufferCharacter array containing the text to write.
indexThe position in the buffer indicating the start of the text to write.
countThe number of characters to write.
Returns
The task that represents the asynchronous WriteChars operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1202 of file XmlWriter.cs.

◆ WriteComment()

abstract void System.Xml.XmlWriter.WriteComment ( string  text)
pure virtual

When overridden in a derived class, writes out a comment <!–...–> containing the specified text.

Parameters
textText to place inside the comment.
Exceptions
T:System.ArgumentExceptionThe text would result in a non-well-formed XML document.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteCommentAsync()

virtual Task System.Xml.XmlWriter.WriteCommentAsync ( string  text)
virtual

Asynchronously writes out a comment <!–...–> containing the specified text.

Parameters
textText to place inside the comment.
Returns
The task that represents the asynchronous WriteComment operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1121 of file XmlWriter.cs.

◆ WriteDocType()

abstract void System.Xml.XmlWriter.WriteDocType ( string  name,
string  pubid,
string  sysid,
string  subset 
)
pure virtual

When overridden in a derived class, writes the DOCTYPE declaration with the specified name and optional attributes.

Parameters
nameThe name of the DOCTYPE. This must be non-empty.
pubidIf non-null it also writes PUBLIC "pubid" "sysid" where pubid and sysid are replaced with the value of the given arguments.
sysidIf pubid is null and sysid is non-null it writes SYSTEM "sysid" where sysid is replaced with the value of this argument.
subsetIf non-null it writes [subset] where subset is replaced with the value of this argument.
Exceptions
T:System.InvalidOperationExceptionThis method was called outside the prolog (after the root element).
T:System.ArgumentExceptionThe value for name would result in invalid XML.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteDocTypeAsync()

virtual Task System.Xml.XmlWriter.WriteDocTypeAsync ( string  name,
string  pubid,
string  sysid,
string  subset 
)
virtual

Asynchronously writes the DOCTYPE declaration with the specified name and optional attributes.

Parameters
nameThe name of the DOCTYPE. This must be non-empty.
pubidIf non-null it also writes PUBLIC "pubid" "sysid" where pubid and sysid are replaced with the value of the given arguments.
sysidIf pubid is null and sysid is non-null it writes SYSTEM "sysid" where sysid is replaced with the value of this argument.
subsetIf non-null it writes [subset] where subset is replaced with the value of this argument.
Returns
The task that represents the asynchronous WriteDocType operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1017 of file XmlWriter.cs.

◆ WriteElementString() [1/3]

void System.Xml.XmlWriter.WriteElementString ( string  localName,
string  value 
)

Writes an element with the specified local name and value.

Parameters
localNameThe local name of the element.
valueThe value of the element.
Exceptions
T:System.ArgumentExceptionThe localName value is null or an empty string.-or-The parameter values are not valid.
T:System.Text.EncoderFallbackExceptionThere is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 769 of file XmlWriter.cs.

◆ WriteElementString() [2/3]

void System.Xml.XmlWriter.WriteElementString ( string  localName,
string  ns,
string  value 
)

Writes an element with the specified local name, namespace URI, and value.

Parameters
localNameThe local name of the element.
nsThe namespace URI to associate with the element.
valueThe value of the element.
Exceptions
T:System.ArgumentExceptionThe localName value is null or an empty string.-or-The parameter values are not valid.
T:System.Text.EncoderFallbackExceptionThere is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 782 of file XmlWriter.cs.

◆ WriteElementString() [3/3]

void System.Xml.XmlWriter.WriteElementString ( string  prefix,
string  localName,
string  ns,
string  value 
)

Writes an element with the specified prefix, local name, namespace URI, and value.

Parameters
prefixThe prefix of the element.
localNameThe local name of the element.
nsThe namespace URI of the element.
valueThe value of the element.
Exceptions
T:System.ArgumentExceptionThe localName value is null or an empty string.-or-The parameter values are not valid.
T:System.Text.EncoderFallbackExceptionThere is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 801 of file XmlWriter.cs.

◆ WriteElementStringAsync()

async Task System.Xml.XmlWriter.WriteElementStringAsync ( string  prefix,
string  localName,
string  ns,
string  value 
)

Asynchronously writes an element with the specified prefix, local name, namespace URI, and value.

Parameters
prefixThe prefix of the element.
localNameThe local name of the element.
nsThe namespace URI of the element.
valueThe value of the element.
Returns
The task that represents the asynchronous WriteElementString operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1619 of file XmlWriter.cs.

◆ WriteEndAttribute()

abstract void System.Xml.XmlWriter.WriteEndAttribute ( )
pure virtual

When overridden in a derived class, closes the previous M:System.Xml.XmlWriter.WriteStartAttribute(System.String,System.String) call.

Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteEndAttributeAsync()

virtual internal Task System.Xml.XmlWriter.WriteEndAttributeAsync ( )
protectedvirtual

Asynchronously closes the previous M:System.Xml.XmlWriter.WriteStartAttribute(System.String,System.String) call.

Returns
The task that represents the asynchronous WriteEndAttribute operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1099 of file XmlWriter.cs.

◆ WriteEndDocument()

abstract void System.Xml.XmlWriter.WriteEndDocument ( )
pure virtual

When overridden in a derived class, closes any open elements or attributes and puts the writer back in the Start state.

Exceptions
T:System.ArgumentExceptionThe XML document is invalid.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteEndDocumentAsync()

virtual Task System.Xml.XmlWriter.WriteEndDocumentAsync ( )
virtual

Asynchronously closes any open elements or attributes and puts the writer back in the Start state.

Returns
The task that represents the asynchronous WriteEndDocument operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1003 of file XmlWriter.cs.

◆ WriteEndElement()

abstract void System.Xml.XmlWriter.WriteEndElement ( )
pure virtual

When overridden in a derived class, closes one element and pops the corresponding namespace scope.

Exceptions
T:System.InvalidOperationExceptionThis results in an invalid XML document.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteEndElementAsync()

virtual Task System.Xml.XmlWriter.WriteEndElementAsync ( )
virtual

Asynchronously closes one element and pops the corresponding namespace scope.

Returns
The task that represents the asynchronous WriteEndElement operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1040 of file XmlWriter.cs.

◆ WriteEntityRef()

abstract void System.Xml.XmlWriter.WriteEntityRef ( string  name)
pure virtual

When overridden in a derived class, writes out an entity reference as &amp;name;.

Parameters
nameThe name of the entity reference.
Exceptions
T:System.ArgumentExceptionname is either null or String.Empty.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteEntityRefAsync()

virtual Task System.Xml.XmlWriter.WriteEntityRefAsync ( string  name)
virtual

Asynchronously writes out an entity reference as &amp;name;.

Parameters
nameThe name of the entity reference.
Returns
The task that represents the asynchronous WriteEntityRef operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1144 of file XmlWriter.cs.

◆ WriteFullEndElement()

abstract void System.Xml.XmlWriter.WriteFullEndElement ( )
pure virtual

When overridden in a derived class, closes one element and pops the corresponding namespace scope.

Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteFullEndElementAsync()

virtual Task System.Xml.XmlWriter.WriteFullEndElementAsync ( )
virtual

Asynchronously closes one element and pops the corresponding namespace scope.

Returns
The task that represents the asynchronous WriteFullEndElement operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1050 of file XmlWriter.cs.

◆ WriteName()

virtual void System.Xml.XmlWriter.WriteName ( string  name)
virtual

When overridden in a derived class, writes out the specified name, ensuring it is a valid name according to the W3C XML 1.0 recommendation (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name).

Parameters
nameThe name to write.
Exceptions
T:System.ArgumentExceptionname is not a valid XML name; or name is either null or String.Empty.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 392 of file XmlWriter.cs.

◆ WriteNameAsync()

virtual Task System.Xml.XmlWriter.WriteNameAsync ( string  name)
virtual

Asynchronously writes out the specified name, ensuring it is a valid name according to the W3C XML 1.0 recommendation (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name).

Parameters
nameThe name to write.
Returns
The task that represents the asynchronous WriteName operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1288 of file XmlWriter.cs.

◆ WriteNmToken()

virtual void System.Xml.XmlWriter.WriteNmToken ( string  name)
virtual

When overridden in a derived class, writes out the specified name, ensuring it is a valid NmToken according to the W3C XML 1.0 recommendation (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name).

Parameters
nameThe name to write.
Exceptions
T:System.ArgumentExceptionname is not a valid NmToken; or name is either null or String.Empty.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 377 of file XmlWriter.cs.

◆ WriteNmTokenAsync()

virtual Task System.Xml.XmlWriter.WriteNmTokenAsync ( string  name)
virtual

Asynchronously writes out the specified name, ensuring it is a valid NmToken according to the W3C XML 1.0 recommendation (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name).

Parameters
nameThe name to write.
Returns
The task that represents the asynchronous WriteNmToken operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1273 of file XmlWriter.cs.

◆ WriteNode() [1/2]

virtual void System.Xml.XmlWriter.WriteNode ( XmlReader  reader,
bool  defattr 
)
virtual

When overridden in a derived class, copies everything from the reader to the writer and moves the reader to the start of the next sibling.

Parameters
readerThe T:System.Xml.XmlReader to read from.
defattrtrue to copy the default attributes from the XmlReader; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionreader is null.
T:System.ArgumentExceptionreader contains invalid characters.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 596 of file XmlWriter.cs.

◆ WriteNode() [2/2]

virtual void System.Xml.XmlWriter.WriteNode ( XPathNavigator  navigator,
bool  defattr 
)
virtual

Copies everything from the T:System.Xml.XPath.XPathNavigator object to the writer. The position of the T:System.Xml.XPath.XPathNavigator remains unchanged.

Parameters
navigatorThe T:System.Xml.XPath.XPathNavigator to copy from.
defattrtrue to copy the default attributes; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionnavigator is null.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 669 of file XmlWriter.cs.

◆ WriteNodeAsync() [1/2]

virtual Task System.Xml.XmlWriter.WriteNodeAsync ( XmlReader  reader,
bool  defattr 
)
virtual

Asynchronously copies everything from the reader to the writer and moves the reader to the start of the next sibling.

Parameters
readerThe T:System.Xml.XmlReader to read from.
defattrtrue to copy the default attributes from the XmlReader; otherwise, false.
Returns
The task that represents the asynchronous WriteNode operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1373 of file XmlWriter.cs.

◆ WriteNodeAsync() [2/2]

virtual async Task System.Xml.XmlWriter.WriteNodeAsync ( XPathNavigator  navigator,
bool  defattr 
)
virtual

Asynchronously copies everything from the T:System.Xml.XPath.XPathNavigator object to the writer. The position of the T:System.Xml.XPath.XPathNavigator remains unchanged.

Parameters
navigatorThe T:System.Xml.XPath.XPathNavigator to copy from.
defattrtrue to copy the default attributes; otherwise, false.
Returns
The task that represents the asynchronous WriteNode operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1517 of file XmlWriter.cs.

◆ WriteProcessingInstruction()

abstract void System.Xml.XmlWriter.WriteProcessingInstruction ( string  name,
string  text 
)
pure virtual

When overridden in a derived class, writes out a processing instruction with a space between the name and text as follows: <?name text?>.

Parameters
nameThe name of the processing instruction.
textThe text to include in the processing instruction.
Exceptions
T:System.ArgumentExceptionThe text would result in a non-well formed XML document. name is either null or String.Empty.This method is being used to create an XML declaration after M:System.Xml.XmlWriter.WriteStartDocument has already been called.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteProcessingInstructionAsync()

virtual Task System.Xml.XmlWriter.WriteProcessingInstructionAsync ( string  name,
string  text 
)
virtual

Asynchronously writes out a processing instruction with a space between the name and text as follows: <?name text?>.

Parameters
nameThe name of the processing instruction.
textThe text to include in the processing instruction.
Returns
The task that represents the asynchronous WriteProcessingInstruction operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1133 of file XmlWriter.cs.

◆ WriteQualifiedName()

virtual void System.Xml.XmlWriter.WriteQualifiedName ( string  localName,
string  ns 
)
virtual

When overridden in a derived class, writes out the namespace-qualified name. This method looks up the prefix that is in scope for the given namespace.

Parameters
localNameThe local name to write.
nsThe namespace URI for the name.
Exceptions
T:System.ArgumentExceptionlocalName is either null or String.Empty. localName is not a valid name.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 405 of file XmlWriter.cs.

◆ WriteQualifiedNameAsync()

virtual async Task System.Xml.XmlWriter.WriteQualifiedNameAsync ( string  localName,
string  ns 
)
virtual

Asynchronously writes out the namespace-qualified name. This method looks up the prefix that is in scope for the given namespace.

Parameters
localNameThe local name to write.
nsThe namespace URI for the name.
Returns
The task that represents the asynchronous WriteQualifiedName operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1300 of file XmlWriter.cs.

◆ WriteRaw() [1/2]

abstract void System.Xml.XmlWriter.WriteRaw ( char []  buffer,
int  index,
int  count 
)
pure virtual

When overridden in a derived class, writes raw markup manually from a character buffer.

Parameters
bufferCharacter array containing the text to write.
indexThe position within the buffer indicating the start of the text to write.
countThe number of characters to write.
Exceptions
T:System.ArgumentNullExceptionbuffer is null.
T:System.ArgumentOutOfRangeExceptionindex or count is less than zero. -or-The buffer length minus index is less than count .
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteRaw() [2/2]

abstract void System.Xml.XmlWriter.WriteRaw ( string  data)
pure virtual

When overridden in a derived class, writes raw markup manually from a string.

Parameters
dataString containing the text to write.
Exceptions
T:System.ArgumentExceptiondata is either null or String.Empty.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteRawAsync() [1/2]

virtual Task System.Xml.XmlWriter.WriteRawAsync ( char []  buffer,
int  index,
int  count 
)
virtual

Asynchronously writes raw markup manually from a character buffer.

Parameters
bufferCharacter array containing the text to write.
indexThe position within the buffer indicating the start of the text to write.
countThe number of characters to write.
Returns
The task that represents the asynchronous WriteRaw operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1215 of file XmlWriter.cs.

◆ WriteRawAsync() [2/2]

virtual Task System.Xml.XmlWriter.WriteRawAsync ( string  data)
virtual

Asynchronously writes raw markup manually from a string.

Parameters
dataString containing the text to write.
Returns
The task that represents the asynchronous WriteRaw operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1226 of file XmlWriter.cs.

◆ WriteStartAttribute() [1/3]

void System.Xml.XmlWriter.WriteStartAttribute ( string  localName,
string  ns 
)

Writes the start of an attribute with the specified local name and namespace URI.

Parameters
localNameThe local name of the attribute.
nsThe namespace URI of the attribute.
Exceptions
T:System.Text.EncoderFallbackExceptionThere is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 199 of file XmlWriter.cs.

◆ WriteStartAttribute() [2/3]

abstract void System.Xml.XmlWriter.WriteStartAttribute ( string  prefix,
string  localName,
string  ns 
)
pure virtual

When overridden in a derived class, writes the start of an attribute with the specified prefix, local name, and namespace URI.

Parameters
prefixThe namespace prefix of the attribute.
localNameThe local name of the attribute.
nsThe namespace URI for the attribute.
Exceptions
T:System.Text.EncoderFallbackExceptionThere is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteStartAttribute() [3/3]

void System.Xml.XmlWriter.WriteStartAttribute ( string  localName)

Writes the start of an attribute with the specified local name.

Parameters
localNameThe local name of the attribute.
Exceptions
T:System.InvalidOperationExceptionThe writer is closed.
T:System.Text.EncoderFallbackExceptionThere is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 219 of file XmlWriter.cs.

◆ WriteStartAttributeAsync()

virtual internal Task System.Xml.XmlWriter.WriteStartAttributeAsync ( string  prefix,
string  localName,
string  ns 
)
protectedvirtual

Asynchronously writes the start of an attribute with the specified prefix, local name, and namespace URI.

Parameters
prefixThe namespace prefix of the attribute.
localNameThe local name of the attribute.
nsThe namespace URI for the attribute.
Returns
The task that represents the asynchronous WriteStartAttribute operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1089 of file XmlWriter.cs.

◆ WriteStartDocument() [1/2]

abstract void System.Xml.XmlWriter.WriteStartDocument ( )
pure virtual

When overridden in a derived class, writes the XML declaration with the version "1.0".

Exceptions
T:System.InvalidOperationExceptionThis is not the first write method called after the constructor.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteStartDocument() [2/2]

abstract void System.Xml.XmlWriter.WriteStartDocument ( bool  standalone)
pure virtual

When overridden in a derived class, writes the XML declaration with the version "1.0" and the standalone attribute.

Parameters
standaloneIf true, it writes "standalone=yes"; if false, it writes "standalone=no".
Exceptions
T:System.InvalidOperationExceptionThis is not the first write method called after the constructor.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteStartDocumentAsync() [1/2]

virtual Task System.Xml.XmlWriter.WriteStartDocumentAsync ( )
virtual

Asynchronously writes the XML declaration with the version "1.0".

Returns
The task that represents the asynchronous WriteStartDocument operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 982 of file XmlWriter.cs.

◆ WriteStartDocumentAsync() [2/2]

virtual Task System.Xml.XmlWriter.WriteStartDocumentAsync ( bool  standalone)
virtual

Asynchronously writes the XML declaration with the version "1.0" and the standalone attribute.

Parameters
standaloneIf true, it writes "standalone=yes"; if false, it writes "standalone=no".
Returns
The task that represents the asynchronous WriteStartDocument operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 993 of file XmlWriter.cs.

◆ WriteStartElement() [1/3]

void System.Xml.XmlWriter.WriteStartElement ( string  localName,
string  ns 
)

When overridden in a derived class, writes the specified start tag and associates it with the given namespace.

Parameters
localNameThe local name of the element.
nsThe namespace URI to associate with the element. If this namespace is already in scope and has an associated prefix, the writer automatically writes that prefix also.
Exceptions
T:System.InvalidOperationExceptionThe writer is closed.
T:System.Text.EncoderFallbackExceptionThere is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 110 of file XmlWriter.cs.

◆ WriteStartElement() [2/3]

abstract void System.Xml.XmlWriter.WriteStartElement ( string  prefix,
string  localName,
string  ns 
)
pure virtual

When overridden in a derived class, writes the specified start tag and associates it with the given namespace and prefix.

Parameters
prefixThe namespace prefix of the element.
localNameThe local name of the element.
nsThe namespace URI to associate with the element.
Exceptions
T:System.InvalidOperationExceptionThe writer is closed.
T:System.Text.EncoderFallbackExceptionThere is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteStartElement() [3/3]

void System.Xml.XmlWriter.WriteStartElement ( string  localName)

When overridden in a derived class, writes out a start tag with the specified local name.

Parameters
localNameThe local name of the element.
Exceptions
T:System.InvalidOperationExceptionThe writer is closed.
T:System.Text.EncoderFallbackExceptionThere is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 131 of file XmlWriter.cs.

◆ WriteStartElementAsync()

virtual Task System.Xml.XmlWriter.WriteStartElementAsync ( string  prefix,
string  localName,
string  ns 
)
virtual

Asynchronously writes the specified start tag and associates it with the given namespace and prefix.

Parameters
prefixThe namespace prefix of the element.
localNameThe local name of the element.
nsThe namespace URI to associate with the element.
Returns
The task that represents the asynchronous WriteStartElement operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1030 of file XmlWriter.cs.

◆ WriteString()

abstract void System.Xml.XmlWriter.WriteString ( string  text)
pure virtual

When overridden in a derived class, writes the given text content.

Parameters
textThe text to write.
Exceptions
T:System.ArgumentExceptionThe text string contains an invalid surrogate pair.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteStringAsync()

virtual Task System.Xml.XmlWriter.WriteStringAsync ( string  text)
virtual

Asynchronously writes the given text content.

Parameters
textThe text to write.
Returns
The task that represents the asynchronous WriteString operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1177 of file XmlWriter.cs.

◆ WriteSurrogateCharEntity()

abstract void System.Xml.XmlWriter.WriteSurrogateCharEntity ( char  lowChar,
char  highChar 
)
pure virtual

When overridden in a derived class, generates and writes the surrogate character entity for the surrogate character pair.

Parameters
lowCharThe low surrogate. This must be a value between 0xDC00 and 0xDFFF.
highCharThe high surrogate. This must be a value between 0xD800 and 0xDBFF.
Exceptions
T:System.ArgumentExceptionAn invalid surrogate character pair was passed.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteSurrogateCharEntityAsync()

virtual Task System.Xml.XmlWriter.WriteSurrogateCharEntityAsync ( char  lowChar,
char  highChar 
)
virtual

Asynchronously generates and writes the surrogate character entity for the surrogate character pair.

Parameters
lowCharThe low surrogate. This must be a value between 0xDC00 and 0xDFFF.
highCharThe high surrogate. This must be a value between 0xD800 and 0xDBFF.
Returns
The task that represents the asynchronous WriteSurrogateCharEntity operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1189 of file XmlWriter.cs.

◆ WriteValue() [1/10]

virtual void System.Xml.XmlWriter.WriteValue ( object  value)
virtual

Writes the object value.

Parameters
valueThe object value to write. Note   With the release of the .NET Framework 3.5, this method accepts T:System.DateTimeOffset as a parameter.
Exceptions
T:System.ArgumentExceptionAn invalid value was specified.
T:System.ArgumentNullExceptionThe value is null.
T:System.InvalidOperationExceptionThe writer is closed or in error state.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 428 of file XmlWriter.cs.

◆ WriteValue() [2/10]

virtual void System.Xml.XmlWriter.WriteValue ( string  value)
virtual

Writes a T:System.String value.

Parameters
valueThe T:System.String value to write.
Exceptions
T:System.ArgumentExceptionAn invalid value was specified.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 442 of file XmlWriter.cs.

◆ WriteValue() [3/10]

virtual void System.Xml.XmlWriter.WriteValue ( bool  value)
virtual

Writes a T:System.Boolean value.

Parameters
valueThe T:System.Boolean value to write.
Exceptions
T:System.ArgumentExceptionAn invalid value was specified.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 455 of file XmlWriter.cs.

◆ WriteValue() [4/10]

virtual void System.Xml.XmlWriter.WriteValue ( DateTime  value)
virtual

Writes a T:System.DateTime value.

Parameters
valueThe T:System.DateTime value to write.
Exceptions
T:System.ArgumentExceptionAn invalid value was specified.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 464 of file XmlWriter.cs.

◆ WriteValue() [5/10]

virtual void System.Xml.XmlWriter.WriteValue ( DateTimeOffset  value)
virtual

Writes a T:System.DateTimeOffset value.

Parameters
valueThe T:System.DateTimeOffset value to write.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 473 of file XmlWriter.cs.

◆ WriteValue() [6/10]

virtual void System.Xml.XmlWriter.WriteValue ( double  value)
virtual

Writes a T:System.Double value.

Parameters
valueThe T:System.Double value to write.
Exceptions
T:System.ArgumentExceptionAn invalid value was specified.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 490 of file XmlWriter.cs.

◆ WriteValue() [7/10]

virtual void System.Xml.XmlWriter.WriteValue ( float  value)
virtual

Writes a single-precision floating-point number.

Parameters
valueThe single-precision floating-point number to write.
Exceptions
T:System.ArgumentExceptionAn invalid value was specified.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 500 of file XmlWriter.cs.

◆ WriteValue() [8/10]

virtual void System.Xml.XmlWriter.WriteValue ( decimal  value)
virtual

Writes a T:System.Decimal value.

Parameters
valueThe T:System.Decimal value to write.
Exceptions
T:System.ArgumentExceptionAn invalid value was specified.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 510 of file XmlWriter.cs.

◆ WriteValue() [9/10]

virtual void System.Xml.XmlWriter.WriteValue ( int  value)
virtual

Writes a T:System.Int32 value.

Parameters
valueThe T:System.Int32 value to write.
Exceptions
T:System.ArgumentExceptionAn invalid value was specified.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 520 of file XmlWriter.cs.

◆ WriteValue() [10/10]

virtual void System.Xml.XmlWriter.WriteValue ( long  value)
virtual

Writes a T:System.Int64 value.

Parameters
valueThe T:System.Int64 value to write.
Exceptions
T:System.ArgumentExceptionAn invalid value was specified.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 530 of file XmlWriter.cs.

◆ WriteWhitespace()

abstract void System.Xml.XmlWriter.WriteWhitespace ( string  ws)
pure virtual

When overridden in a derived class, writes out the given white space.

Parameters
wsThe string of white space characters.
Exceptions
T:System.ArgumentExceptionThe string contains non-white space characters.
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

◆ WriteWhitespaceAsync()

virtual Task System.Xml.XmlWriter.WriteWhitespaceAsync ( string  ws)
virtual

Asynchronously writes out the given white space.

Parameters
wsThe string of white space characters.
Returns
The task that represents the asynchronous WriteWhitespace operation.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter asynchronous method was called without setting the P:System.Xml.XmlWriterSettings.Async flag to true. In this case, T:System.InvalidOperationException is thrown with the message “Set XmlWriterSettings.Async to true if you want to use Async Methods.”

Definition at line 1166 of file XmlWriter.cs.

Property Documentation

◆ Settings

virtual XmlWriterSettings System.Xml.XmlWriter.Settings
get

Gets the T:System.Xml.XmlWriterSettings object used to create this T:System.Xml.XmlWriter instance.

Returns
The T:System.Xml.XmlWriterSettings object used to create this writer instance. If this writer was not created using the Overload:System.Xml.XmlWriter.Create method, this property returns null.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 23 of file XmlWriter.cs.

◆ WriteState

abstract WriteState System.Xml.XmlWriter.WriteState
get

When overridden in a derived class, gets the state of the writer.

Returns
One of the T:System.Xml.WriteState values.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 36 of file XmlWriter.cs.

◆ XmlLang

virtual string System.Xml.XmlWriter.XmlLang
get

When overridden in a derived class, gets the current xml:lang scope.

Returns
The current xml:lang scope.
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 65 of file XmlWriter.cs.

◆ XmlSpace

virtual XmlSpace System.Xml.XmlWriter.XmlSpace
get

When overridden in a derived class, gets an T:System.Xml.XmlSpace representing the current xml:space scope.

Returns
An XmlSpace representing the current xml:space scope.Value Meaning None This is the default if no xml:space scope exists. Default The current scope is xml:space="default". Preserve The current scope is xml:space="preserve".
Exceptions
T:System.InvalidOperationExceptionAn T:System.Xml.XmlWriter method was called before a previous asynchronous operation finished. In this case, T:System.InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”

Definition at line 52 of file XmlWriter.cs.


The documentation for this class was generated from the following file: