Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] Shredding XML

From: Cecil New <cecil.new@-----.--->
To: xml-dev@-----.---.---
Date: 11/3/2009 1:23:00 AM
Possibly a generic schema would work... by that I mean design where the
tables are "vertical" instead of "horizontal".  In a vertical table
approach, you have a parent column, child column, type column, and a value
column.  For xml shredding, add the actual element names for the child.  The
parent/child columns are generated keys that store the parent/child
elements.  Plus you'd need a table to store the attribute values: child key,
attrib name, attrib type (if needed), attrib value.

The value column is always a string, which must be converted to the
associated type.

It will take a bit of logic to do the shredding, but once written, it won't
need any modification for new element nodes or new attributes.

Use recursion to recover the xml hierarchical structure and element values.
Join to the attribute table to pick up the attribute value (you'll need to
combine the two with logic - you can't do this with a single sql statement).
[Note: Oracle recursion maintains parent/child row relationships - not sure
that DB2 does this; I know Teradata cannot.  If DB2 does not maintain
parent/child row relationships, then you'll need to write recursive logic to
do this instead of a simple SQL statement.]

In the end, each row in the parent/child table represents an element node
(the child).  And each row in the attrib table represents one attrib and
value for the corresponding child element.

Finally, you'll need a fake node to store the root.  Hope this makes sense;
sort of designed this on the fly while writing.

Cheers.


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