I'm using C# and reading an XML document like the following (example):
<it>
<abc>123</abc>
<stuff>0</stuff>
<jumbo>
<big>false</big>
<large>true</large>
</jumbo>
</it>
I'm using the xPathNavigator and xPathNodeIterator to go through each node. The problem is I don't always know what nodes will be in the <it> node. So I need a way to iterate through the nodes and just add the node name and value to an array. I've almost got it however when I use the xPathNodeIterator and search all descendants it returns "falsetrue" for the <jumbo> node - apparently reading the value of this node concatenates the two child node values.
Is there a way around this? I want to iterate through each node and return just the node name and value without adding an element that has child elements.
Start Free Trial