This is the easy way. I’ll post other ways later.
- Make a mockup well formed XML file.
- From Visual Studio 2003, open the XML and right click on the open document. Select Create Schema. This creates an XSD file.
- You can edit values of specific part of the schema at this time. Only edit the properties section tagged “Misc”. Touching the dataset section will break the ability to generate the code behind the XSD.
- If you add the XSD namespace to the root element of the XML file, while both the XML and XSD are in your project, you will get intellisence for editing the XML.
- Once you are finished editing the XSD, you can right click on the XSD in the editor and select “Generate Dataset”
Now you have a type strong XML editor for your XML document.
Your next step is reading an writing. to read the XML into the dataset just type in yourdatasetname.ReadXML(“C:\somepath”)
To write the XML back out, type yourdatasetname.WriteXML(“C:\somepath”)
That is it in a nut shell. I’ll post more soon.