>>>convert the incoming XML stream into a set of relational tables that
>>>meta-modeled XML structures.  Anyone who has done this before knows,
XML
>>>to Relational Mapping can get quite complicated.

I have.  The worst is the nesting and finding what nodes to update.
There almost has to be ground rules.

I have broken relational theory in order to map XML
-storing multiple data points in a single column i.e. an array
-using generic data type specific tables for all data, this is a cool
way but so slow....
                
Example:
        XML for Person:
        <Person Age=30 Name="George Bush"/>

        A Relational Mapping:
        Id      Column Type  Column Name
        1       int              Age
        2       nvarchar(30) Last Name  


        Now create a table for the XML Type, but it has no columns!!!!!

        Person
                Key     int

        That's all just one column!


        Now store the values in these type specific tables:

        IntValues
                Key             int
                node_type       int
                Value           int

        CharValues
                Key     int
                node_type       int
                Value   varchar(255)    
        


        Lets say that a XML Person is Node_type 1.

        Person  IntValues
        (1)             (1)     (1) (30)  <----- Primary Key 1 for
Person contains a 30
                
                        CharValues
                        (1)     (1) (George Bush)


        
Next create Generic "Tree" implemented as a relational table that will
map limited hierarchical nesting.

Exmaple:

prd_id  int
node_id int
parent_id       int
rank            int
node_type       char
thumbnail       varchar(120
product_id      int
lvl             int
hierarchy       varchar(900)

This table is used to map "node_type" which are XML types Person,
Company etc.


Why? Would you ever do this???

1) so you can have on the fly schema changes...storing metadata is a
snap
2) so you can map any arrangement of complex data
3) so you can go hierarchical
4) you can always MAP to a relational table for speed later.

Tony Leotta
www.pillarsoftware.com



--
http://cms-list.org/
more signal, less noise.

Reply via email to