BUG: Namespace "xml" is not reserved when using System.Xml (317503)
The information in this article applies to:
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2003), Professional Edition
- Microsoft .NET Framework Class Libraries 1.1
- Microsoft .NET Framework Class Libraries 1.0
This article was previously published under Q317503 SYMPTOMS If you use an XmlDocument(System.Xml namespace) call to create the xml:lang attribute on an element, the "xml" namespace prefix is not
associated with http://www.w3.org/XML/1998/namespace as it needs to. For
example, the following code
XmlDocument x = new XmlDocument();
XmlElement c = x.CreateElement("test");
c.SetAttribute("xml:lang", "en-US");
x.AppendChild(c);
Console.Out.WriteLine( "'" + x.DocumentElement.Attributes[0].NamespaceURI + "'" );
Console.Out.WriteLine( "'" + x.DocumentElement.Attributes[0].Prefix + "'");
produces the following output:
''
'xml'
The expected output is as follows:
'http://www.w3.org/XML/1998/namespace'
'xml'
RESOLUTION If you need to persist XML data, use the XmlTextWriter object to output the correct result. See the "More Information"
section for sample code. STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 9/15/2005 |
---|
Keywords: | kbvs2002sp1sweep kbbug kbpending KB317503 |
---|
|