IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Profile: Rachitha
About
User Name: Rachitha
Forum Rank: Newbie
Real Name:
Location Bangalore
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Friday, October 17, 2014
Last Visit: Friday, October 17, 2014 7:51:26 AM
Number of Posts: 1
[0.01% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: Advice on Create DB Structure from XML Schema
Posted: Friday, October 17, 2014 7:51:02 AM
Hello,

I am facing a similar problem while using Altova XMLSpy 2015 Enterprise Edition.

Below is a sample xsd I have created. Two tables Company and Employee where employee's company Id is mapped to the Company Id. I do a JDBC connection to database MySQL 5.0 and use the "Create DB structure from Xml Schema". The tables are created but no foreign keys or primary keys appear.

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Database">
<xs:complexType>
<xs:sequence>
<xs:element name="COMPANY">
<xs:complexType>
<xs:sequence>
<xs:element name="EMPLOYEE">
<xs:complexType>
<xs:attribute name="EMPLOYEEID" type="xs:int">
</xs:attribute>
<xs:attribute name="EMPLOYEENAME" type="xs:string">
</xs:attribute>
<xs:attribute name="EMPLOYEECOMPANYID" type="xs:int">
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="COMPANYID" type="xs:int">
</xs:attribute>
<xs:attribute name="COMPANYNAME" type="xs:string">
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:key name="COMPANY_PRIMARY_KEY">
<xs:selector xpath="COMPANY"/>
<xs:field xpath="@COMPANYID"/>
</xs:key>
<xs:key name="EMPLOYEE_FOREIGN_KEY">
<xs:selector xpath="COMPANY/EMPLOYEE"/>
<xs:field xpath="@EMPLOYEEID"/>
<xs:field xpath="@EMPLOYEECOMPANYID"/>
</xs:key>
</xs:element>
</xs:schema>

Let me know if I am missing any configuration setting to get this. It would be of great help.

Thank you.

Regards,
Rachitha

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.