I'm simply trying to query an xml document and iterate over the results minus specific elements. Ideally I would like to achieve this in the query rather than removing it from the collection before or during iteration.
<body>
Stuff I want
<element>
Stuff I dont want
</element>
</body>
I tried something along these lines but had no luck....
var doc = XDocument.Load("document.xml");
var results = doc.Descendants("body")
.Where(x => x.Name != "element")
I'm certainly out of my element using XML, apologies if this has been answered already.