It has been years since I messed with XPath and need some guidance.
Here is the xml fragment:
<?xml version="1.0" encoding="utf-8"?>
<ConfigurationObject xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="1" i:type="AlgorithmDataSourceConfiguration" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" xmlns="http://www.foo.com/bar/2008/03">
<ConfigurationSection z:Id="2">
<Type z:Id="3">
<Name z:Id="4">AlgorithmDataSource</Name>
CODE:
XmlDocument doc = new XmlDocument();
doc.Load(path);
XmlNamespaceManager mng = new XmlNamespaceManager(doc.NameTable);
mng.AddNamespace("z", "http://schemas.microsoft.com/2003/10/Serialization/");
XmlNodeList list = doc.SelectNodes("ConfigurationObject/ConfigurationSection /@z:Id=\"4\"",mng);
foreach(XmlNode s in list)
{
Console.WriteLine(s.InnerText);
}
The list doesn't contain any nodes??
What do you think?