Sunday, 8 September 2013

Reading XML using LINQ

Reading XML using LINQ

Hi I am looking for LINQ query to extract
Level1 Type, subtype
Level4 Path
from the xml sample below. I am really looking for a single LINQ query so
I can step through the resultant data.
<?xml version="1.0" encoding="utf-8"?>
<Toplevels>
<TopLevel>
<Level1>
<Type>Read this</Type>
<Subtype>Read this</Subtype>
</Level1>
<Level2>
<Level3>
<Level4>
<L4Node path="read this" />
</Level4>
</Level3>
</Level2>
</TopLevel>
<TopLevel>
<Level1>
<Type>Read this</Type>
<Subtype>Read this</Subtype>
</Level1>
<Level2>
<Level3>
<Level4>
<L4Node path="read this" />
</Level4>
</Level3>
</Level2>
</TopLevel>
<TopLevel>
<Level1>
<Type>Read this</Type>
<Subtype>Read this</Subtype>
</Level1>
<Level2>
<Level3>
<Level4>
<L4Node path="read this" />
</Level4>
</Level3>
</Level2>
</TopLevel>
</Toplevels>
can anyone help please?
Thanks in advance

No comments:

Post a Comment