[Home] [By Thread] [By Date] [Recent Entries]

  • From: Jerry Murray <Jmurray@I...>
  • To: "'xml-dev@l...'" <xml-dev@l...>
  • Date: Tue, 11 Jul 2000 19:47:23 -0700


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@i...
650/463-4264


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member