Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Converting XML data dump to SQL [Thread Next] Re: Converting XML data dump to SQLTo: NULL Date: 7/1/2008 2:31:00 PM Thanks to both of you for your responses. There is good information
there, but I don't think it really does quite what I want.
Here's a somewhat truncated version of one of the records from the
dump I'm trying to work with:
<products>
<product>
<sku>SN3030</sku>
<name>30" 030 Snake Chain Necklace</name>
<kind>basic</kind>
<summary><![CDATA[]]></summary>
<weight>5.0</weight>
<description><![CDATA[]]></description>
...
<cost>13.8</cost>
<price>
<priceset>US</priceset>
<price>41.4</price>
<saleprice>41.4</saleprice>
<suggestedprice>41.4</suggestedprice>
<available>true</available>
<featured>false</featured>
<onsale>false</onsale>
<taxexempt>false</taxexempt>
<lineitemdiscount>false</lineitemdiscount>
<shippingexempt>false</shippingexempt>
<fixedquantity>Fixed Quantity</fixedquantity>
<usemap>false</usemap>
</price>
<category>
<path>Necklaces / Long Necklaces</path>
<position>20</position>
</category>
<category>
<path>Chains</path>
<position>70</position>
</category>
<category>
<path>Chains / Silver Chains</path>
<position>10</position>
</category>
<category>
<path>Necklaces</path>
<position>60</position>
</category>
<downloadurl></downloadurl>
<ignoredescriptionlines>false</ignoredescriptionlines>
<inclusivevariationconflicts></inclusivevariationconflicts>
<drawmultiplevariations>false</drawmultiplevariations>
</product>
BTW, this is the export of StoreOnline product database. It would be
desireable to be able to write the database back out in the same
format, though that is a secondary goal.
You see that there is a parent datarow, product, with some child rows,
including price, and categories, which may occur multiple times per
product row. I tried doing an XML import into Access, and it did
correctly read in all the tables, but it did nothing to establish any
foreign key relations between the rows. So, for example, I have an
entry in the price table for $41.40,etc., but nothing to tie that
entry to product SKU SN3030. Also, some of the tables, such as
category, only have a limited number of entries, but in parsing the
XML input, it creates one row in the category table every time that
entry occurs, and, again, of course, nothing linking any of those rows
to the product that they represent.
Just for point of reference, the tables represented here are product,
price, category, variation (such as size, color, etc.) (which also has
another child table called choice), feature, and link.
Since the XML parser seems to do a pretty good job of inferring the
schema, I was hoping there might be a program around that I could feed
in the XML file and get back something analogous to a MySQLDump output
- a set of SQL CREATE TABLE statements, each followed by INSERT INTO
table...
I guess that was hoping for a little too much! LOL I guess I'll have
to use the schema that it created and the XML parser to write a
program to read the data and write it out to the DB, creating the
Foreign keys along the way.
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
