1,105,625 Community Members

Programmatically generating DataSet classes using XSD.exe tool

Member Avatar
acezrwild817
Light Poster
25 posts since Dec 2004
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

In the VS command prompt that is part of the VS SDK you can enter the following to generate an xsd file from an xml file:

xsd XMLfilename.xml

This will generate an xsd file with the same name as the xml file

Then you can enter:

xsd [.xsd file generated from above] /d /language:CS

This will generate a .cs file with the same name as the .xml and .xsd from above. In your program you can then load the xml file into a dataset in memory and query it programmatically using the class that was generated for that xml file.

I am searching for a way to perform the above steps programmatically rather than using the command prompt. Does anyone know how to do this?

Member Avatar
StrikerX11
Light Poster
27 posts since Jun 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 0 [?]
 
0
 

are you asking for something like dataSet.Read/WriteXMLSchema methods ?

Member Avatar
acezrwild817
Light Poster
25 posts since Dec 2004
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Yes that is similar, but I need the class (.cs file) that is auto-generated when using the command prompt. Can this be generated programmatically?

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article