<PackageReference Include="System.Xml.ReaderWriter" Version="4.0.11-beta-23409" />

XmlWriter

public abstract class XmlWriter : IDisposable
Represents a writer that provides a fast, non-cached, forward-only way to generate streams or files that contain XML data.
public virtual XmlWriterSettings Settings { get; }

Gets the XmlWriterSettings object used to create this XmlWriter instance.

public abstract WriteState WriteState { get; }

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

public virtual string XmlLang { get; }

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

public virtual XmlSpace XmlSpace { get; }

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

protected XmlWriter()

Initializes a new instance of the XmlWriter class.

public static XmlWriter Create(Stream output)

Creates a new XmlWriter instance using the specified stream.

public static XmlWriter Create(Stream output, XmlWriterSettings settings)

Creates a new XmlWriter instance using the stream and XmlWriterSettings object.

public static XmlWriter Create(TextWriter output)

Creates a new XmlWriter instance using the specified TextWriter.

public static XmlWriter Create(TextWriter output, XmlWriterSettings settings)

Creates a new XmlWriter instance using the TextWriter and XmlWriterSettings objects.

public static XmlWriter Create(StringBuilder output)

Creates a new XmlWriter instance using the specified StringBuilder.

public static XmlWriter Create(StringBuilder output, XmlWriterSettings settings)

Creates a new XmlWriter instance using the StringBuilder and XmlWriterSettings objects.

public static XmlWriter Create(XmlWriter output)

Creates a new XmlWriter instance using the specified XmlWriter object.

public static XmlWriter Create(XmlWriter output, XmlWriterSettings settings)

Creates a new XmlWriter instance using the specified XmlWriter and XmlWriterSettings objects.

public void Dispose()

Releases all resources used by the current instance of the XmlWriter class.

protected virtual void Dispose(bool disposing)

Releases the unmanaged resources used by the XmlWriter and optionally releases the managed resources.

public 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.

public virtual Task FlushAsync()

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

public 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.

public 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 XmlReader.

public virtual Task WriteAttributesAsync(XmlReader reader, bool defattr)

Asynchronously writes out all the attributes found at the current position in the XmlReader.

public 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.

public void WriteAttributeString(string localName, string value)

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

public 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.

public 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.

public 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.

public virtual Task WriteBase64Async(byte[] buffer, int index, int count)

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

public 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.

public virtual Task WriteBinHexAsync(byte[] buffer, int index, int count)

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

public abstract void WriteCData(string text)

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

public virtual Task WriteCDataAsync(string text)

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

public abstract void WriteCharEntity(char ch)

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

public virtual Task WriteCharEntityAsync(char ch)

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

public abstract void WriteChars(char[] buffer, int index, int count)

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

public virtual Task WriteCharsAsync(char[] buffer, int index, int count)

Asynchronously writes text one buffer at a time.

public abstract void WriteComment(string text)

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

public virtual Task WriteCommentAsync(string text)

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

public 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.

public virtual Task WriteDocTypeAsync(string name, string pubid, string sysid, string subset)

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

public void WriteElementString(string localName, string value)

Writes an element with the specified local name and value.

public void WriteElementString(string localName, string ns, string value)

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

public void WriteElementString(string prefix, string localName, string ns, string value)

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

public Task WriteElementStringAsync(string prefix, string localName, string ns, string value)

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

public abstract void WriteEndAttribute()

When overridden in a derived class, closes the previous WriteStartAttribute call.

public abstract void WriteEndDocument()

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

public virtual Task WriteEndDocumentAsync()

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

public abstract void WriteEndElement()

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

public virtual Task WriteEndElementAsync()

Asynchronously closes one element and pops the corresponding namespace scope.

public abstract void WriteEntityRef(string name)

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

public virtual Task WriteEntityRefAsync(string name)

Asynchronously writes out an entity reference as &name;.

public abstract void WriteFullEndElement()

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

public virtual Task WriteFullEndElementAsync()

Asynchronously closes one element and pops the corresponding namespace scope.

public 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).

public 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).

public 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).

public 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).

public 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.

public 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.

public 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?>.

public 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?>.

public 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.

public virtual 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.

public abstract void WriteRaw(char[] buffer, int index, int count)

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

public abstract void WriteRaw(string data)

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

public virtual Task WriteRawAsync(char[] buffer, int index, int count)

Asynchronously writes raw markup manually from a character buffer.

public virtual Task WriteRawAsync(string data)

Asynchronously writes raw markup manually from a string.

public void WriteStartAttribute(string localName, string ns)

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

public 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.

public void WriteStartAttribute(string localName)

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

public abstract void WriteStartDocument()

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

public abstract void WriteStartDocument(bool standalone)

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

public virtual Task WriteStartDocumentAsync()

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

public virtual Task WriteStartDocumentAsync(bool standalone)

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

public void WriteStartElement(string localName, string ns)

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

public 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.

public void WriteStartElement(string localName)

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

public virtual Task WriteStartElementAsync(string prefix, string localName, string ns)

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

public abstract void WriteString(string text)

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

public virtual Task WriteStringAsync(string text)

Asynchronously writes the given text content.

public 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.

public virtual Task WriteSurrogateCharEntityAsync(char lowChar, char highChar)

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

public virtual void WriteValue(object value)

Writes the object value.

public virtual void WriteValue(string value)

Writes a String value.

public virtual void WriteValue(bool value)

Writes a Boolean value.

public virtual void WriteValue(DateTimeOffset value)

Writes a DateTimeOffset value.

public virtual void WriteValue(double value)

Writes a Double value.

public virtual void WriteValue(float value)

Writes a single-precision floating-point number.

public virtual void WriteValue(decimal value)

Writes a Decimal value.

public virtual void WriteValue(int value)

Writes a Int32 value.

public virtual void WriteValue(long value)

Writes a Int64 value.

public abstract void WriteWhitespace(string ws)

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

public virtual Task WriteWhitespaceAsync(string ws)

Asynchronously writes out the given white space.