Using Visual C# 2005, how can I programmatically create physical tables in a
DBMS from an XML schema or an XML file?
The only way is manually parsing the file to generate the "CREATE TABLE" SQL
statement?
Use ADO.NET to read the XML into an ADO DataSet. If the XML has an XML
Schema, then you can use that to first create the table(s) in the
DataSet with all of the columns having appropriate types.*
Then use the ADO DataSet to create tables in the DBMS.
* If you don't have a schema, your biggest problem will be determining
the types of the data columns. For example, if an XML attribute says
code="50234", is that an alphanumeric field, or an integer? How big
can it get? etc. The XML Schema could give you answers to these
questions, allow ADO.NET to create data columns with the correct
types, and make the job of creating the tables in the DBMS much
simpler. Without the schema, you might be forced to make every column
a varying length string column.