ReadXml into a DataTable?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I've gotten the dataset.ReadXml() method to load XML from a remote source
but I was wondering since I plan on having multiple datatables in the
dataset, can you specify which table to read XML into? I'm using ASP.NET 1.1

Thanks, Dave
 
Using the 1.1 framework I don't believe that there is - however the way the
XML document is structured will control how it's loaded. As such, you have
two alternatives that come to mind off of the top of my head. 1) If you can
control the XML you are reading, you can manipulate to load into whatever
table(s) you want 2) If you can't control the XML document, you could use an
XSLT Translation to take your XML, and get it in a format that will load
into the tables you want it to - from there you can just use ReadXML like
you normally would. I'll look around and see if there's another way but I
don't recall seeing any table mappings. Fortunately in the near future
there's going to be full XML support for DataTables under the 2.0 framework
but that doesn't solve anything for you until then.

Cheers,

Bill
 
Thanks, but I guess I don't understand the part "if you can control the XML
you are reading, you can manipulate it to load into whatever table(s) you
want ". I'm not sure how the ReadXml know which of the 3 datatables I want
to load it into if I create tables like....

DataTable dtOne = new DataTable();
dst.Tables.Add(dtOne);
etc..

Thanks again. Dave.
 
You can always read the new data into a separate DataSet and perform a merge
operation on a single table.

Alex
 
Back
Top