xml spy
Previous  Top  Next
Shape strings

Data shaping is one of the new features of ADO 2.6. The basic idea behind data shaping, is the hierarchical record set. Data shaping allows a column of a master record set to itself contain another record set - a child record set.

It is important to distinguish between hierarchical record sets and hierarchical databases.
·Hierarchical record sets are standard record sets, where the data is represented hierarchically by parent, child or even grandchild tables.  
·Hierarchical databases actually store data in an hierarchical format.  

Please note:  
To be able to use the Shape language, you must have Microsoft Data Access Components Version 2.1 or later, installed on your computer. Please contact your IT-department for help if this is not the case.  
 
 
Please see: the link http://support.microsoft.com/support/kb/articles/Q189/6/57.ASP for more information on Shape commands in general.

Importing hierarchical data

To import hierarchical data you can construct you own shape commands manually and enter them into the Selection statement text box, or have XML Spy automatically create them using the Create Database schema and then the XML Import based on DB Schema commands. The Shape commands are included in the Shapes.txt file, and on the following pages.

Please note:
·The Data_shape.mdb file was created by exporting to an Access database from the Data_shape.xml file (this XML file is included with XML Spy)  
·All these examples are imported without external primary and foreign key values  
·All the imported data are defined as Elements by default  
·The "Create empty elements from empty fields" check box is inactive  
·The preview window of the Database import dialog box of the data is included  
·The resulting import file is displayed vertically, allowing you to see the data structure more clearly (the Display as table function is deactivated for the respective row element)  
·Child elements (eg. Persons) are expanded  


Shape string to import Division and Persons

Shape {SELECT * FROM Division} as Division
APPEND ({SELECT * FROM Person} as Person
RELATE PrimaryKey to ForeignKey) as Person

Preview window:
tut_s1_odb14a


tut_s1_odb14b
Result on import into XML Spy

Shape String to import Company, Division and Persons

SHAPE {SELECT * FROM Company} as Company
APPEND((Shape {SELECT * FROM Division} as Division
APPEND ({SELECT * FROM Person} as Person
RELATE PrimaryKey to ForeignKey) as Person) as Division
RELATE PrimaryKey to ForeignKey) as Division

Preview window:
tut_s1_odb15a
Please note:  
The name space prefix has been suppressed in these examples because the option "Exclude Namespace" was activated during the export process. Thus xmlns:xsi becomes xsi, and xsi:SchemaLocation becomes SchemaLocation.  
tut_s1_odb15b
Result on import into XML Spy

Shape string to import Company, Address and Division

SHAPE {SELECT * FROM Company} as Company
APPEND ({SELECT * FROM Address} as Address
RELATE PrimaryKey to ForeignKey) as Address,
({SELECT * FROM Division} as Division
RELATE PrimaryKey to ForeignKey) as Division

Preview window:
tut_s1_odb15a

tut_s1_odb16b
Result on import into XML Spy

Shape string to import Company, Address, Division and Persons

SHAPE {SELECT * FROM Company} as Company
APPEND({SELECT * FROM Address} as Address
RELATE PrimaryKey to ForeignKey) as Address,
((SHAPE{SELECT * FROM Division} as Division
APPEND ({SELECT * FROM Person} as Person
RELATE PrimaryKey to ForeignKey) as Person) as Division
RELATE PrimaryKey to ForeignKey) as Division

Preview window:
tut_s1_odb15a

tut_s1_odb17b
Result on import into XML Spy




Previous  Top  Next

⌐ 2002 Altova