Wednesday, 18 September 2013

LINQ to XML - parent's attribute in where clause

LINQ to XML - parent's attribute in where clause

I'm having troubles with this where clause;
from item in
_documentRoot.Descendants("Level1").Descendants("Level2").Descendants("Level3")
where
_documentRoot.Descendants("Level1").Descendants("Level2").Attributes("id").First().Value
== 12345
I want a list of Level3 items from the Level2 element that has an id of
12345.
as always, many thanks

No comments:

Post a Comment