I am using this xml:
And this is some part part of my code :
XmlNodeList nameList = xmldoc.SelectNodes("//employee/person");
foreach (XmlNode nameNode in nameList)
{
if (nameNode.SelectSingleNode("name").InnerText == "c")
{
string bug1 = nameNode.SelectSingleNode("//send/name1").InnerText;
string bug2 = nameNode.SelectSingleNode("lucky").InnerText;
}
}
On executing this code, i should expect
bug1 = d
bug2 = 160
but i am getting
bug1 = b
bug2 = 160
Please help...Tell me if i am wrong in selecting node (//send/name1)....
Thanks

Jean PaulRank #32 · 38.5K reputationPosted Jan 13, 2011, 4:38 AM EST
string bug1 = nameNode.SelectSingleNode("send/name1").InnerText;
The '//' is resolving to the start of xml nodes.
night sailor20 reputationPosted Jan 13, 2011, 8:56 AM EST
Jean PaulRank #32 · 38.5K reputationPosted Jan 13, 2011, 8:29 PM EST