How to get all the Child Elements

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
HI,
I have a Requirement that i have to get all the Child nodes as a collection.
I have a XML like
<Root>
<span style="white-space:pre <L1>
<span style="white-space:pre </L1>
<span style="white-space:pre <L2>
<span style="white-space:pre </L2>
<span style="white-space:pre <L1>
<span style="white-space:pre </L1>
<span style="white-space:pre <L2>
<span style="white-space:pre </L2>
<span style="white-space:pre <L1>
<span style="white-space:pre </L1>
<span style="white-space:pre <L2>
<span style="white-space:pre </L2>
</Root>

I have to get all the L1 and L2 in to a Collection ...
For Getting only L1 i can write a query like xDocument.Descendants("L1") and so on for L2..
How can i get both L1 and L2 as a Element Collection

Thanks in Advance
Pavan B.V <hr class="sig Pavan Kumar B.V

View the full article
 
Back
Top