Create A Class representing your xml. You can generate class using xsd.exe it comes with VS.
http://msdn.microsoft.com/en-us/library/x6c1kb0s(v=vs.80).aspx[
^]
The very normal location of xsd.exe is:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin
C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin
You can also use xsdobjectgenerator for more accurate results:
http://www.microsoft.com/en-us/download/details.aspx?id=7075[
^]
Once your class is created, you can use it serialize/deserialize your xml
public void CreateXML(Object oObject)
{
XmlDocument xmlDoc = new XmlDocument();
XmlSerializer xmlSerializer = new XmlSerializer(oObject.GetType());
using (Stream xmlStream = new FileStream("Yourpathtoxmlfile", System.IO.FileMode.OpenOrCreate))
{
xmlSerializer.Serialize(xmlStream, oObject);
xmlStream.Close();
}
}
An example on serialization:
http://www.jonasjohn.de/snippets/csharp/xmlserializer-example.htm[
^]