Select more then one node from XML using LINQ

Posted by podeig on Stack Overflow See other posts from Stack Overflow or by podeig
Published on 2010-05-12T06:14:49Z Indexed on 2010/05/12 6:24 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

I have such XML

<root>
    <content>
        ....
    </content>
    <index>
        ....
    </index>
    <keywords>
        ....
    </keywords>
</root>

But I need to select just and nodes.

<content>
    ....
</content>
<index>
    ....
</index>

I found out how to select just one node.

XElement Content = new XElement("content", from el in xml.Elements() select el.Element("content").Elements());

How can I get both nodes?

© Stack Overflow or respective owner

Related posts about Xml

Related posts about c#