Old answer, assuming you had control of the XML
You could try creating the data structure you want, mocking up a console app that populates that data structure, and use XmlSerializer
to automatically output a sample XML file. C# will be able to import the result with no extra code.
If you want to customize the XML, you can use attributes in the System.Xml.Serialization
namespace to mark up your code, and get custom element/attribute names.
Edit:
Removed code sample, because it doesn't apply to the final answer.
The XML you have isn't conducive to simple XML serialization in C#. If you play around with the suggestion I made in the old version of my answer, you'll see this is true.
I suggest you create hierarchical data structures in C# that map to the problem you are trying to solve, in C#, rather than trying to bend them around the XML data that you happen to have.
Once you have that structure, work on implementing IXmlSerializable
for each of those data types.
Beware that custom XML serialization is a pain, so if you can, you should make your serialization/data work to support your code, not the other way around.
You could get around this fact by writing an XSLT to convert your data to a format that is more amenable to XML serialization. Here's a way to apply an XSLT transform in C#:
How to apply an XSLT Stylesheet in C#
If you do this, my original answer applies. Make a data structure that is easily serializable to/from your intermediate format.