Example 3: Transforming an attribute of an element to a column

In the example, the complex element - Employees will be transformed to a table, named Employees, the sub-elements Employee will be transformed to another table, named Employee, and attributes of these sub-elements will be transformed to columns in the Employee table.

The following is a segment of an XSD file:

...
<xsd:attribute name="id" type="xsd:long"/>
<xsd:attribute name="name" type="xsd tring"/>
<xsd:attribute name="age" type="xsd:int"/>
...

The following is a segment of an XML file:

...
<Employees groupId="1";>
<Employee id="1", name="John", age="23"/>
<Employee id="9" name="Sally" age="22"/>
...
</Employees>
...

The following table named Employees is transformed from the parent element - Employees:

In the result table, these two columns NodePrimaryKey and NodeForeignKey are generated by system automatically in the transformation process.

The following table named Employee is transformed from sub-elements - Employee:

In the result table, these two columns NodePrimaryKey and NodeForeignKey are generated by system automatically in the transformation process and the foreign key in the Employee is mapped to the primary key in the Employees table.