Posted on: 1/19/2015 12:16:33 PM | Views : 612

I want to get the list of xml elements where the first child of those element is equal to a string.
var levelxml = xdoc.XPathSelectElement(@"/topic/chapter/section[@id='D2']/level[@id='D3']"); var extended = levelxml.Elements().ToList();  // this gives the list of xml elements
But I want the list of those elements only where the first child has "abc" element.
If I apply the foreach of the above (var extended), then it's getting the results 
foreach (var el in extended) {
var fca = el.Elements() .Where(x => string.Compare(x.Name.ToString(), "abc", true) == 0) .ToList();

}
But how do I get the list of parent elements where it's first child elements has "abc" in it.

Go to the complete details ...