R
ryanbreakspear
Hi,
I've been doing a bit of reading on the Internet, but can't work out
what is the best way to load an XML file into a table. The XML file is
normalised, so for each record I create in my database table, I'll need
to grab data from the nodes above.
e.g.
<sex>
<title>Male</title>
<eyecolourgroup>
<colour>blue</colour>
<person>
<name>John</name>
</person>
<person>
<name>Bill</name>
</person>
<colour>brown</colour>
<person>
<name>Fred</name>
</person>
</eyecolourgroup>
</sex>
<sex>
<title>Female</title>
<eyecolourgroup>
<colour>blue</colour>
<person>
<name>Jane</name>
</person>
</eyecolourgroup>
</sex>
I want the data to look like:
Sex colour name
male blue John
male blue Bill
male brown Fred
female blue Jane
Obviously I can traverse the XML and build up the values myself, but I
wondered if there was some sort of magic way I can get the values out.
I've tried loading the data into a Datagrid, but I'm not sure how I can
treat it all as one row.
Any ideas would be much appreciated.
Thanks
Ryan
I've been doing a bit of reading on the Internet, but can't work out
what is the best way to load an XML file into a table. The XML file is
normalised, so for each record I create in my database table, I'll need
to grab data from the nodes above.
e.g.
<sex>
<title>Male</title>
<eyecolourgroup>
<colour>blue</colour>
<person>
<name>John</name>
</person>
<person>
<name>Bill</name>
</person>
<colour>brown</colour>
<person>
<name>Fred</name>
</person>
</eyecolourgroup>
</sex>
<sex>
<title>Female</title>
<eyecolourgroup>
<colour>blue</colour>
<person>
<name>Jane</name>
</person>
</eyecolourgroup>
</sex>
I want the data to look like:
Sex colour name
male blue John
male blue Bill
male brown Fred
female blue Jane
Obviously I can traverse the XML and build up the values myself, but I
wondered if there was some sort of magic way I can get the values out.
I've tried loading the data into a Datagrid, but I'm not sure how I can
treat it all as one row.
Any ideas would be much appreciated.
Thanks
Ryan