Wednesday, January 02, 2008

XML, XSD.exe usage tips

Here are few quick tips that can help you understand and start with XML basics...

Questions - (preferably in this sequence)
How do you generate XSD ?
You need to have a valid XML file for which you want to have a schema generated ( XSD)
If you have VS .net you can just open the xml file into VS.net and then under XML menu you should see "Create Schema" option that should generate an .xsd file for you!

How do you create classes from an XSD schema?
You can create .net (C#, VB, J#) source code from the xsd using XSD tool (command line) along with MS .net framework.
http://samples.gotdotnet.com/quickstart/howto/doc/xmlserialization/xsdtocls.aspx

How do you convert (deserialize) XML into an object that you can read through .net code?
AND
How do you write out an XML file (serialize) from an object through .net code?

http://samples.gotdotnet.com/quickstart/howto/doc/xmlserialization/rwobjfromxml.aspx

Thats simple ...is it? Thanks - Dipesh

No comments: