In fact, you ignore the value node, using a leading slash to return to the root of the document. Try instead:
foreach (XPathNavigator node in xPathNavigator.Select("//locations/*"))
{
string value = node.SelectSingleNode("cell").Value;
}
Having said that, is there a reason why you are not doing this in a single XPath request?
foreach (XPathNavigator node in navigator.Select("//locations/location/cell"))
{
string value = node.Value;
}
source
share