Go Back   GIDForums > Computer Programming Forums > .NET Forum
User Name
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Thread Tools Search this Thread Rate Thread
Old 15-Nov-2006, 03:34
Menol_LK's Avatar
Menol_LK Menol_LK is offline
Junior Member
Join Date: Sep 2006
Location: Sri Lanka
Posts: 29
Menol_LK is on a distinguished road

XSD to Data Table in VB.NET


I have an xsd which contains a single element along with it's attributes.
I need a method to create a data table to match that element according to the way that element is defined in xsd.

say for an example: I have defined the element box in xsd file with attributes: length, width, height

now I want to make a data table which will be able to store box type rows.
in other words, the resulting table should have columns: height, width, length

I really need this help soon because at the moment I am wasting a lot of my time on hard coding this (column by column for the table)

Thanks in advance!

-- Menol --
Old 17-Nov-2006, 05:42
erniegerdie erniegerdie is offline
Awaiting Email Confirmation
Join Date: Feb 2004
Location: England
Posts: 93
erniegerdie has a spectacular aura abouterniegerdie has a spectacular aura about

Re: XSD to Data Table in VB.NET

Curious as to why you want to create the DataTable from the xsd. I'm not sure how to do that.

However, its quite easy to create a datatable from xml.

I knocked up a little test.

Xml Data held in 'XmlFile1.xml'
HTML Code:
<Test> <Column1>Data 1</Column1> <Column2>Data 2</Column2> <Column3>Data 3</Column3> </Test>

Load the xml
C-SHARP / C# Code:
DataSet ds = new DataSet();
string cdir = System.Environment.Current.Directory + @"\XMLFile1.xml";

//Load the xml

//Get the datatable from the dataset
DataTable dt = ds.Tables[0];

// Display all the column names in the Debug output
foreach (DataColumn dclmn in dt.Columns)

You could use the xsd and .NET Framework (XmlValidatingReader) to validate the data before you read it into the DataSet, that way you know that the data and columns created in the DataTable conform to your xsd.

Hopefully that helps...

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Doubly-linked List dsmith C Programming Language 6 14-Apr-2006 13:12
Strange C++ code memory leakage problem gaoanyu C++ Forum 7 04-Nov-2005 09:09
[CONTEST?]Data Structure Test dsmith C Programming Language 2 06-Jun-2004 15:13

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:53.

vBulletin, Copyright © 2000 - 2018, Jelsoft Enterprises Ltd.