Using xml source in datagrid -- possible with non-structured data?

  • Thread starter Thread starter KatB
  • Start date Start date
K

KatB

Hi, is it possible to use a datagrid (read only) that has an xml source
that is NOT database-type structured? For example:

<assembly>
<work_order no="12345">
<station name="one">
<boards>
<board sn="111" start="10/23/03 11:30:12am"/>
<board sn="112" start="10/23/03 11:35:14am"/>
<board sn="113" start="10/23/03 11:40:16am"/>
</boards>
</station>
<station name="two">
<boards>
<board sn="111" start="10/23/03 12:30:12am"/>
<board sn="112" start="10/23/03 12:35:10am"/>
<board sn="113" start="10/23/03 12:40:15am"/>
</boards>
</station>
<station name="three">
<boards>
<board sn="111" start="10/24/03 08:10:10am"/>
<board sn="112" start="10/24/03 08:15:05am"/>
<board sn="113" start="10/24/03 08:20:30am"/>
</boards>
</station>
</work_order>
</assembly>

The datagrid report would look like:

Station SN Start
------------------------------------------
One 111 10/23/03 12:30:12am
------------------------------------------
One 112 10/23/03 11:35:14am
------------------------------------------
One 113 10/23/03 11:40:16am
------------------------------------------
Two 111 10/23/03 12:30:12am
------------------------------------------
Two 112 10/23/03 12:35:10am
------------------------------------------
etc.

If someone could point me to examples or explain a bit how to do this?

Thanks, Kat
 
KatB said:
Hi, is it possible to use a datagrid (read only) that has an xml source
that is NOT database-type structured? For example:

<assembly>
<work_order no="12345">
<station name="one">
<boards>
<board sn="111" start="10/23/03 11:30:12am"/>
<board sn="112" start="10/23/03 11:35:14am"/>
<board sn="113" start="10/23/03 11:40:16am"/>
</boards>
</station>
<station name="two">
<boards>
<board sn="111" start="10/23/03 12:30:12am"/>
<board sn="112" start="10/23/03 12:35:10am"/>
<board sn="113" start="10/23/03 12:40:15am"/>
</boards>
</station>
<station name="three">
<boards>
<board sn="111" start="10/24/03 08:10:10am"/>
<board sn="112" start="10/24/03 08:15:05am"/>
<board sn="113" start="10/24/03 08:20:30am"/>
</boards>
</station>
</work_order>
</assembly>

The datagrid report would look like:

Station SN Start
------------------------------------------
One 111 10/23/03 12:30:12am
------------------------------------------
One 112 10/23/03 11:35:14am
------------------------------------------
One 113 10/23/03 11:40:16am
------------------------------------------
Two 111 10/23/03 12:30:12am
------------------------------------------
Two 112 10/23/03 12:35:10am
------------------------------------------
etc.

If someone could point me to examples or explain a bit how to do this?

Thanks, Kat

Yes, if you read the XML into a dataset, it will infer a schema (table
structure) for you....check out this article about consuming an RSS feed
with a datagrid ASP.NET page...follow its principles of finding the
tables in the dataset:

http://aspnet.4guysfromrolla.com/articles/031903-1.aspx
 
dim ds as new dataset
ds.readxml("c:\xmlsrc.xml")
it will work
use this ds as datasource for ur grid
 
Back
Top