XSD.exe, Salad Tosser and Studio 2005
Man this post is exciting me so much and it really should you too! Handling XML through microsoft XSD.exe tool which can be found from the frameworks command line utility!
I'm not sure how studio 2003 handles this but 2005 has this brilliant little feature.
When you add an XSD file to your project it automatically generates the object hierarchy and creates a typed dataset that wraps the object hierarchy.
If im still talking greek or is it geek I will elaborate a little.
Create a simple xml file call it salad tosser
<?
xml version="1.0" encoding="UTF-8"?><tosser myNewLanguage='salad'>
<saladTosser name='1' />
<saladTosser name='2' />
<saladTosser name='3' />
<saladTosser name='4' />
<saladTosser name='5' />
<saladTosser name='6' />
</tosser>
Go to
1. Start > All Programs> Microsoft Visual Studio 2005 > Visual Studio 2005 > Visual Studio 2005 Command Prompt
2. Type in XSD.exe
3.Enter xsd.exe [your path to saladtosser.xml]
4. It will write you out an XSD file to a location (which you can specify if desired)
5. Add this to your project
6. WALA
Studio generates the typed dataset and object hierarchy!!!!!
You now have a typed dataset that handles loading files following the rules created in the xsd schema. There are still a few down sides one of them being that the typed datasets are all called NewDataSet. I know what most of you are saying ... yeah salad tosser is too simple! I have tried it on very complex schema's including namespaces and stuff and had very positive results!