XmlWriter.WriteQualifiedName Method
.NET Framework 4
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.
Assembly: System.Xml (in System.Xml.dll)
Parameters
- localName
- Type: System.String
The local name to write.
- ns
- Type: System.String
The namespace URI for the name.
| Exception | Condition |
|---|---|
| ArgumentException |
localName is either null or String.Empty. localName is not a valid name. |
The example writes the following element:
<root xmlns:x="urn:abc"> <item href="#x:test"/> </root>
XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.OmitXmlDeclaration = true; using (XmlWriter writer = XmlWriter.Create(Console.Out, settings)) { writer.WriteStartElement("root"); writer.WriteAttributeString("xmlns", "x", null, "urn:abc"); writer.WriteStartElement("item"); writer.WriteStartAttribute("href", null); writer.WriteString("#"); writer.WriteQualifiedName("test", "urn:abc"); writer.WriteEndAttribute(); writer.WriteEndElement(); writer.WriteEndElement(); }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note