Connecting Tech Pros Worldwide Help | Site Map

nested xml to table

Newbie
 
Join Date: Apr 2009
Posts: 1
#1: Apr 2 '09
Hello everyone
I have an XML file which is a multitable nested xml file (.Tables.Count returned 12 tables). I would like to have all of the xml contents in one table or, if not, select different columns from these different tables (that are stored in XML) and put them in one table.
As I understood Datagridview only allows only one table at a time. Is there any way to create a new datatable by joining exsting tables from XML?
I'm sure there is some solution to this.
Thanks in advance!
MrMancunian's Avatar
Expert
 
Join Date: Jul 2008
Location: Utrecht, The Netherlands
Posts: 274
#2: Apr 8 '09

re: nested xml to table


Hi LCookie, I'm not sure how a multitable nested XML file looks, but I'm sure that if you create a parser that reads the file, you can put the values in a new created DataTable. It will be quite some work, but it definitely is a possibility.

If you can post the XML code, or at least two or three tables (instead of twelve), it would be a bit more simple to help you find a solution.

Steven
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#3: Apr 14 '09

re: nested xml to table


Quote:

Originally Posted by LCookie View Post

Hello everyone
I have an XML file which is a multitable nested xml file (.Tables.Count returned 12 tables). I would like to have all of the xml contents in one table or, if not, select different columns from these different tables (that are stored in XML) and put them in one table.
As I understood Datagridview only allows only one table at a time. Is there any way to create a new datatable by joining exsting tables from XML?
I'm sure there is some solution to this.
Thanks in advance!


How are you currently creating your tables from the XML file?

As Steven has already stated, you would have to create one table instead of multiple tables at that stage to use with your DataGridView.

If you have loaded your XML file into a DataTable Objects you can use the Merge Method to merge the tables together into one table...which can be used with your DataGridView.

You can read an xml file into a DataSet....the DataSet will contain all of the tables (as DataTable Objects) that your XML file contains. All you have to do is merge the ones that you need to display.

-Frinny
Reply

Tags
datagridview, dataset, table, vb net, xml