nested xml to table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LCookie
    New Member
    • Apr 2009
    • 1

    nested xml to table

    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
    Recognized Expert Contributor
    • Jul 2008
    • 569

    #2
    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

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Originally posted by LCookie
      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

      Comment

      Working...