System.Xml.XmlWriter.WriteQualifiedName Method

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.

Syntax

public virtual void WriteQualifiedName (string localName, string ns)

Parameters

ns
The namespace URI for the name.
localName
The local name to write.
ns
The namespace URI for the name.

Exceptions

TypeReason
ArgumentException localName is null, is string.Empty, or is not a valid XML name.
InvalidOperationExceptionThe XmlWriter.WriteState is WriteState.Closed.
System.Xml.XmlException localName is not a valid XML name.

Remarks

If ns maps to the current default namespace, no prefix is generated.

When writing attribute values, this method generates a prefix if ns is not found. When writing element content, it throws an exception if ns is not found.

Note:

If a class derived from the System.Xml.XmlWriter does not override this method localName is not checked to be a valid W3C XML name. In such case, before calling this method, the validity of the string can be checked by XmlReader.IsName(string) method.

For the asynchronous version of this method, see XmlWriter.WriteQualifiedNameAsync(string, 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