I have an Xml that looks something like this (simplified example):
<childrenNode>
<myClass1>
<someValues />
</myClass1>
<myClass2>
<someOtherValues />
</myClass2>
<myClass1>
<someValues />
</myClass1>
<myClass2>
<someOtherValues />
</myClass2>
<myClass1>
<someValues />
</myClass1>
</childrenNode>
For parsing, I use a class that looks something like this:
public class childrenNode
{
public myClass1[] myClass1 { get; set; }
public myClass2[] myClass2 { get; set; }
}
The problem is that I am losing order. I need to know that the second myClass1 is the third element of the array. Ideally, I would serialize Xml in such a way as to keep order:
public class childrenNode
{
public object[] child { get; set; }
}
Xml is output by a third-party application, so I have no chance to change its layout.
Any suggestions on what my alternatives are? Xml is actually massive, so parsing it with XmlReader will be a lot of work.
source
share