Home All Groups Group Topic Archive Search About

using ReadXML with disparate XML data

Author
30 Mar 2005 7:13 PM
Joe
I want to load data from two related but different XML files into a two
different DataTables in a single DataSet, then create relations, and finally
filter and select specific data. I can't figure out how to load the two
different sets of data into one DataSet. For example, the following results
in just one table, and no detail data:

XmlDataDocument datadoc = new XmlDataDocument();
datadoc.DataSet.ReadXml(new StreamReader(@"C:\temp\header.xml"),
XmlReadMode.Auto);
datadoc.DataSet.ReadXml(new StreamReader(@"C:\temp\detail.xml"),
XmlReadMode.Auto);

Trying a few variations of this code didn't get me any further.

Author
30 Mar 2005 9:51 PM
anonymous
DataSet ds = new DataSet();
ds.ReadXml(new StreamReader(@"C:\temp\header.xml"),
XmlReadMode.Auto);
ds.ReadXml(new StreamReader(@"C:\temp\detail.xml"),
XmlReadMode.InferSchema);

ds contains 2 DataTables. one is for header.xml, another
is for detail.xml

>-----Original Message-----
>I want to load data from two related but different XML
files into a two
>different DataTables in a single DataSet, then create
relations, and finally
>filter and select specific data. I can't figure out how
to load the two
>different sets of data into one DataSet. For example, the
following results
>in just one table, and no detail data:
>
>XmlDataDocument datadoc = new XmlDataDocument();
>datadoc.DataSet.ReadXml(new StreamReader
(@"C:\temp\header.xml"),
>XmlReadMode.Auto);
>datadoc.DataSet.ReadXml(new StreamReader
(@"C:\temp\detail.xml"),
Show quote
>XmlReadMode.Auto);
>
>Trying a few variations of this code didn't get me any
further.
>
>
>.
>
Author
31 Mar 2005 2:29 PM
Joe
Beautiful! The two different uses of the XmlReadMode param did the trick.
Thanks.

Show quote
"anonym***@discussions.microsoft.com" wrote:

> DataSet ds = new DataSet();
> ds.ReadXml(new StreamReader(@"C:\temp\header.xml"),
> XmlReadMode.Auto);
> ds.ReadXml(new StreamReader(@"C:\temp\detail.xml"),
> XmlReadMode.InferSchema);
>
> ds contains 2 DataTables. one is for header.xml, another
> is for detail.xml
>
> >-----Original Message-----
> >I want to load data from two related but different XML
> files into a two
> >different DataTables in a single DataSet, then create
> relations, and finally
> >filter and select specific data. I can't figure out how
> to load the two
> >different sets of data into one DataSet. For example, the
> following results
> >in just one table, and no detail data:
> >
> >XmlDataDocument datadoc = new XmlDataDocument();
> >datadoc.DataSet.ReadXml(new StreamReader
> (@"C:\temp\header.xml"),
> >XmlReadMode.Auto);
> >datadoc.DataSet.ReadXml(new StreamReader
> (@"C:\temp\detail.xml"),
> >XmlReadMode.Auto);
> >
> >Trying a few variations of this code didn't get me any
> further.
> >
> >
> >.
> >
>

AddThis Social Bookmark Button