parse Linq To Xml with attribute nodes

Posted by Manoj on Stack Overflow See other posts from Stack Overflow or by Manoj
Published on 2010-03-29T14:01:54Z Indexed on 2010/03/29 14:23 UTC
Read the original article Hit count: 518

Filed under:
|
|
|
|

I am having xml with following structure

<ruleDefinition appId="3" customerId = "acf">

<node alias="element1" id="1" name="department">

<node alias="element2" id="101" name="mike" />

<node alias="element2" id="102" name="ricky" />

<node alias="element2" id="103" name="jim" />

</node>
</ruleDefinition>

Here nodes are differentiated using alias and not with node tag. As you can see top level node element1 has same node name "node" as element2. I want to parse this XML based on attribute alias.

What should be the Linq-To-Xml code (using C#)to acheive this?

© Stack Overflow or respective owner

Related posts about linq-to-xml

Related posts about c#3.0