-----Original Message-----
From: Jerry Murray [mailto:Jmurray@Ironplanet.com]
Sent: Tuesday, July 11, 2000 7:47 PM
To: 'xml-dev@lists.xml.org'
Subject: Mechanics of mapping relational data into XML
I would like to get some suggestions for the mechanics of mapping relational
data into XML for situations where the mapping requires grouping of data.
QUESTION: When exporting relational data to XML, should:
a) the domain model grouping be done by SQL or Java code prior
to creating XML data, or
b) should XML data be created for each table, then have an
application parse the "XML" table documents and write the new desired XML
document.
c) or ... can transformations be performed (e.g. using
something like RELAX) to go from the "XML" table documents to the final
single XML document
d) or... are any tools available that already handle this
situation.
Example
Given a relational database with three tables: x, y ,z
Table x has product information -> one row for each product
For example:
product-id | product_name | product_manufacturer
123 widget1 manufacturerX
456 widget2 manufacturerY
Table y has other product information -> one row for each product
For example:
product-id | product_type | product_class
123 type1 classX
456 type2 classY
Table z has product category - attribute - value information -> multiple
rows for each product
For example:
product-id | product_component | component_attribute |
component_value
123 cover material
plastic
123 cover color blue
123 cover weight_oz 8
123 base material
metal
123 base color gray
123 base weight_oz 6
456 cover material
plastic
456 cover color blue
456 cover weight_oz 4
456 base material
metal
456 base color gray
456 base weight_oz 7
WANTED:
<product>
product_id="123"</product_id>
product_name="widget1"
product_manufacturer="manufacturerX"
product_type="type1"
product_class="classX"
<product_components>
<cover material=plastic color="blue" weight_oz="8"
/>
<base material=metal color="gray" weight_oz="6" />
</product>
<product>
product_id>456"
product_name="widget2"
product_manufacturer="manufacturerY"
product_type="type2"
product_class="classY"
product_components>
<cover material=plastic color="blue" weight_oz="4"
/>
<base material=metal color="gray" weight_oz="7" />
</product>
Thanks,
Jerry
===================
Jerry Murray
jmurray@ironplanet.com
650/463-4264