(Visual Studio 2005 and above)
You probably already have some xml you want to read. Use xsd.exe to generate xsd from the xml:
"c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\xsd.exe" your.xml
It will generate your.xsd in the current directory. Generate code to parse xml as follows:
"c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\xsd.exe" your.xsd /classes /out:<dir_to_put_code>
It will generate your.cs in the specified directory. Include that file in your project. Reading xml can then be done in two ways:
Reading xml from file
TextReader reader = new StreamReader("your.xml");
XmlSerializer serializer = new XmlSerializer(typeof(your));
your y = (your)serializer.Deserialize(reader);
Reading xml from string
StringReader reader = new StringReader("string containing xml");
XmlSerializer serializer = new XmlSerializer(typeof(your));
your y = (your)serializer.Deserialize(reader);





