System.Xml.XmlTextWriter.WriteName Method

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

Syntax

public override void WriteName (string name)

Parameters

name
Name to write.

Exceptions

TypeReason
ArgumentException name is null or string.Empty; or name is not a valid XML Name.
InvalidOperationExceptionThe XmlTextWriter.WriteState is WriteState.Closed.

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.

If XmlTextWriter.Namespaces is set to true, WriteName also checks that the name is also valid according to the W3C Namespaces in XML recommendation.

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