Tuesday, April 30, 2013

Create C# Classes from XML


  1. Find XSD.exe on your PC. Its a .net tool.
  2. Assuming xml name is Statements.xml, run the following:
    xsd.exe Statements.xml
  3. This generates a Statements.xsd file.
  4. Now run this:
    xsd.exe /dataset /language:CS Statements.xsd
  5. This generates Statements.cs, which is fairly useless unless the XML is perfect. At least you have the class names and the properties stubbed out. I just copy and paste these.

No comments:

Post a Comment