Partager via


XmlWriter.WriteQualifiedName Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

Syntax

'Declaration
Public Overridable Sub WriteQualifiedName ( _
    localName As String, _
    ns As String _
)
public virtual void WriteQualifiedName(
    string localName,
    string ns
)

Parameters

Exceptions

Exception Condition
ArgumentException

localName is String.Empty or not a valid name.

NullReferenceException

localName or ns is nulla null reference (Nothing in Visual Basic).

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.

NoteNote:

If a class derived from the 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 IsName method.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.