Gary Stephenson wrote:
Whoops, I probably should have mentioned that the "report"ing I was referring
to was the result of calls to "MoveToNextAttribute" on the XMLReader object.
Sorry, I can't reproduce that problem, e.g. file.xml is
<?xml version="1.0" encoding="UTF-8"?>
<gods xmlns="http://example.com/2006/gods"
xmlns:xhtml="http://www.w3.org/1999/xhtml"/>
and a simple C# program snippet is
using (XmlReader xmlReader = XmlReader.Create(@"file.xml")) {
while (xmlReader.Read()) {
if (xmlReader.NodeType == XmlNodeType.Element) {
Console.WriteLine(
"Found element with local name: {0}, namespace URI: {1}.",
xmlReader.LocalName, xmlReader.NamespaceURI);
while (xmlReader.MoveToNextAttribute()) {
Console.WriteLine(
"Found attribute with prefix: {0}, local name: {1}, namespace URI: {2}",
xmlReader.Prefix, xmlReader.LocalName, xmlReader.NamespaceURI);
}
Console.WriteLine();
}
}
}
output is
Found element with local name: gods, namespace URI:
http://example.com/2006/gods.
Found attribute with prefix: , local name: xmlns, namespace URI:
http://www.w3.org/2000/xmlns/
Found attribute with prefix: xmlns, local name: xhtml, namespace URI:
http://www.w3.org/2000/xmlns/
so both the default namespace declaration and the other namespace
declaration are reported as attributes. Such attributes are by
definition in the namespace with URI
http://www.w3.org/2000/xmlns/, so
that is also correct.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/