<X version="1.0"> <Y id="abc" abv="a"/> <Y id="edf" abv="e"/> </X>
I want to select the node whose identifier is "abc" and return it abv "a".
XmlDocument doc = new XmlDocument(); doc.Load(filePath); XmlNodeList list = doc.SelectNodes("X/Y"); var node = list.Cast<XmlNode>().Where(node => node["id"].InnerText == "abc") .Select(x=>x["abv"].InnerText);
But it does not work, node ["id"]. InnerText is always "". Can you indicate where the problem is?
Thank you so much
ZHE.ZHAO
source share