The Data Model

Tha data model includes one table for the root element (TAB_dataroot), followed by one or more tables for elements at level 1.

In this example, only one element at this level exists (TAB_PRODUCTS). At the next level, you find a table for each element on level 2 (TAB_PR_ID, TAB_PR_NAME, TAB_PR_GROUP1, TAB_PR_PRICE). There can be more nested levels in the XML document, and each level creates another set of tables.

Note:

You can change the prefixes for the generated table names in the DB Schema Options property.

Root Level

Elements lLvel 1

Elements Level 2

TAB_dataroot
     ATT_ROW_ID
     ATT_FK_generated
     ATT_xmlns_od
     ATT_xsi_no

TAB_PRODUCTS
     ATT_ROW_ID
     ATT_FK_dataroot
TAB_PR_ID
     ATT_ROW_ID
     ATT_FK_PRODUCTS
     ATT_PR_ID

TAB_PR_NAME
     ATT_ROW_ID
     ATT_FK_PRODUCTS
     ATT_PR_NAME

TAB_PR_GROUP1
     ATT_ROW_ID
     ATT_FK_PRODUCTS
     ATT_PR_GROUP1

TAB_PR_PRICE
     ATT_ROW_ID
     ATT_FK_PRODUCTS
     ATT_PR_PRICE

The tables are linked through foreign keys. Table TAB_PRODUCTS is linked to TAB_dataroot through the ATT_FK_dataroot attribute.

The tables at level 2 are linked to table PRODUCTS through the ATT_FK_PRODUCTS attribute. To create the view containing the PRODUCTS records, the tables at level 2 must be joined with the TAB_PRODUCTS table.

The join is qualified by the ATT_FK_PRODUCTS attribute of each level 2 table and the ATT_ROW_ID of TAB_PRODUCTS. The only selected attributes are the value attributes of level 2 tables: ATT_PR_ID, ATT_PR_NAME, ATT_PR_GROUP1 and ATT_PR_PRICE.

select  TAB_PR_ID.ATT_PR_ID,
TAB_PR_NAME.ATT_PR_NAME, TAB_PR_GROUP1.ATT_PR_GROUP1,
TAB_PR_PRICE.ATT_PR_PRICE 
FROM  TAB_PRODUCTS, TAB_PR_ID, TAB_PR_NAME,
TAB_PR_GROUP1, TAB_PR_PRICE 
WHERE  TAB_PR_ID.ATT_FK_PRODUCTS =
TAB_PRODUCTS.ATT_ROW_ID AND 
TAB_PR_NAME.ATT_FK_PRODUCTS = TAB_PRODUCTS.ATT_ROW_ID
AND  TAB_PR_GROUP1.ATT_FK_PRODUCTS =
TAB_PRODUCTS.ATT_ROW_ID AND 
TAB_PR_PRICE.ATT_FK_PRODUCTS =
TAB_PRODUCTS.ATT_ROW_ID