I have an xml file I'm trying to deserialize using the .Net XmlSerializer class. I'm having trouble coming up with a C# class that represents the xml format. My main problem is dealing with one element that's used to represent a generic array. The sub-elements of the array are not always the same. I'm also having an issue with arrays of arrays, which I've read isn't natively supported.
Example:
<root>
<parent_1>
<sub_element0 value="0"/>
<sub_element1>
<array idx="0" value="0"/>
<array idx="1" value="0"/>
</sub_element1>
</parent_1>
<parent_2>
<array idx="0">
<array idx="0">
<sub_element2 value="0"/>
</array>
<array idx="1">
<sub_element2 value="0"/>
</array>
</array>
<array idx="1">
<array idx="0">
<sub_element2 value="0"/>
</array>
<array idx="1">
<sub_element2 value="0"/>
</array>
</array>
</parent_2>
</root>
As you can see the array element is used with no sub-elements and with sub-elements (including itself). I can't just create a class named 'array,' so how do I handle this?
Any help is appreciated.