I'm having a problem with reading and processing a xml file, which I cannot solve right now. The xml has the following structure:
<root>
<test id="1">
<a></a>
<b></b>
<c></c>
</test>
<test id="2">
<a></a>
<b></b>
<c></c>
</test>
<test id="3">
<a></a>
<b></b>
<c></c>
</test>
</root>
XmlDocument Doc; int currentid=1;
XmlNode currentlyselectedtestnode =
Doc.SelectNodes("//test[@id = '" +
currentid.ToString() + "']");
string a = currentlyselectedtestnode.SelectSingleNode("//a");
string b = currentlyselectedtestnode.SelectSingleNode("//b");
string c = currentlyselectedtestnode.SelectSingleNode("//c");
Unfortunately, "currentlyselectedtestnode.SelectSingleNode("//a")" will read out all "a"-nodes and not only the one that belongs to test-node with id 1. Why ?! Somehow currentlyselectedtestnode.SelectSingleNode("//a"); works just as if I wrote Doc.SelectSingleNode("//a");
How come ?! How can I make it read the children of the specific test-node only ?ectedtestnode.SelectSingleNode("//c");