Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Converting XML data dump to SQL

From: daveh551 <geekdh@-----.--->
To: 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&quot; 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.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent