Hi,
I've run into this accidentally, with an XML file that was incorrectly generated.
What I do is simply read the attributes of a couple of nodes in a standard way.
The XML file contained a wrong xmlns attribute and the code never returned anything, no error or warning but also no value for the attribute. After completely removing the xmlns attribute, everything works fine.
Could someone explain me why this happens?
Thanks
vlad
I've run into this accidentally, with an XML file that was incorrectly generated.
What I do is simply read the attributes of a couple of nodes in a standard way.
Code:
XPathDocument Doc = new XPathDocument(XMLFile);
XPathNavigator navigator = Doc.CreateNavigator();
XmlNamespaceManager ns = new XmlNamespaceManager(navigator.NameTable);
XPathNodeIterator iterator = navigator.Select("/xxx/yyy");
iterator.MoveNext();
Attr = iterator.Current.GetAttribute("zzz", ns.DefaultNamespace);
The XML file contained a wrong xmlns attribute and the code never returned anything, no error or warning but also no value for the attribute. After completely removing the xmlns attribute, everything works fine.
Could someone explain me why this happens?
Thanks
vlad