Linq Return node level of hierarchical xml
- by Ryan
In a treeview you can retrieve the level of an item. I am trying to accomplish the same thing with the given input being an object.
The XML data I will use for this example would be something like the following
<?xml version="1.0" encoding="utf-8" ?>
<Testing>
<Numbers>
<Number val="1">
<Number val="1.1">
<Number val="1.1.1">
<Number val="1.1.2" />
<Number val="1.1.3" />
<Number val="1.1.4" />
</Number>
</Number>
<Number val="1.2" />
<Number val="1.3" />
<Number val="1.4" />
</Number>
<Number val="2" />
<Number val="3" />
<Number val="4" />
</Numbers>
<Numbers>
<Number val="5" />
<Number val="6" />
<Number val="7" />
<Number val="8" />
</Numbers>
</Testing>
This one is kicking my butt!