System.Xml.XmlTextWriter.WriteStartAttribute Method

Writes the start of an attribute.

Syntax

public override void WriteStartAttribute (string prefix, string localName, string ns)

Parameters

prefix
Namespace prefix of the attribute.
prefix
Namespace prefix of the attribute.
localName
LocalName of the attribute.
ns
NamespaceURI of the attribute

Exceptions

TypeReason
ArgumentException XmlTextWriter.Namespaces is false for the writer, and prefix and ns are not both null or string.Empty.
InvalidOperationExceptionThe XmlTextWriter.WriteState is not one of the following: WriteState.Attribute or WriteState.Element.

Remarks

Note:

In the dnprdnext release, the recommended practice is to create System.Xml.XmlWriter instances using the erload:System.Xml.XmlWriter.Create method and the System.Xml.XmlWriterSettings class. This allows you to take full advantage of all the new features introduced in this release. For more information, see Creating XML Writers.

This is a more advanced version of XmlWriter.WriteAttributeString(string, string, string) that allows you to write an attribute value using multiple write methods, such as XmlTextWriter.WriteString(string).

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0