How about you just save the xml to a file, and use xsd to generate C# classes?
- Write the file to disk (I named it foo.xml)
- Generate the xsd:
xsd foo.xml
- Generate the C#:
xsd foo.xsd /classes
Et voila – and C# code file that should be able to read the data via XmlSerializer
:
XmlSerializer ser = new XmlSerializer(typeof(Cars));
Cars cars;
using (XmlReader reader = XmlReader.Create(path))
{
cars = (Cars) ser.Deserialize(reader);
}
(include the generated foo.cs in the project)