[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Mechanics of mapping relational data into XML

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

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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.