| guxu@hotmail.com 2005-12-05, 8:25 pm |
| I have an annotated XML schema which defines the parent/child
relationship. I was trying to import the xml into SQL tables using XML
bulk load and the schema file. All the data went into the correct
tables just fine except for the key columns of the child tables (The
parent table gets the data for the key). Anybody knows what could
cause the problem?
My schema looks something like below:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xs:annotation>
<xs:appinfo>
<sql:relationship name="Child1_R" parent="Parent" parent-key="ID"
child="Child1" child-key="ID"/>
<sql:relationship name="Child2_R" parent="Parent" parent-key="ID"
child="Child2" child-key="ID"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="Parent" sql:relation="Parent">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
........
<xs:element ref="Child1" sql:relationship="Child1_R"/>
<xs:element ref="Child2" sql:relationship="Child2_R"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Child1" sql:relation="Child1"
sql:relationship="Child1_R">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
.......
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:element>
<xs:element name="Child2" sql:relation="Child2"
sql:relationship="Child2_R">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string"/>
......
</xs:sequence>
</xs:complexType>
</xs:element>
|