I have the following XML:
<PlayerSetup>
<CardDeck name="deckOfCards"/>
<Card name="one"/>
<Card name="two"/>
<Card name="three"/>
<Card name="four"/>
<Token name="four"/>
</PlayerSetup>
I need to retrieve only the elements which attributes name="four", I have the following code:
var query = from d in xdoc.Descendants("PlayerSetup")
where (string)d.Attribute("name").Value == "four"
select d;
Which of course, is not working, returns no elements. Any idea ? Thanks.
PlayerSetupelements with a descendant element with attribute name="four"; or 2) the descendant elements ofPlayerSetupwith attribute name="four"?nameis an attribute ofCardnotPlayerSetup