How to the xsd:keyref field

L

Land

Hi,
I have a XSD file defined a parent elment and some child elments nested in
parent. I use xsd:key defined the key of parent emlment and xsd:keyref
defined the foreign key of child elments. But how to make child's foreign key
defined by xsd:keyref automatically equal parent's key when use fill
InfoPath's sheet?

Many thanks for your rely!!

This is the XSD file:
<xs:schema id="MyDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

<xs:element name="MyDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="OrderDetail">
<xs:complexType>
<xs:sequence>
<xs:element name="OrderNo" type="xs:integer" />
<xs:element name="ItemNo" type="xs:string" />
<xs:element name="Order">
<xs:complexType>
<xs:sequence>
<xs:element name="OrderNumber" type="xs:integer" />
<xs:element name="EmpNumber" type="xs:integer" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

</xs:choice>
</xs:complexType>

<xs:key name="OrderNumberKey" >
<xs:selector xpath=".//Order" />
<xs:field xpath="OrderNumber" />
</xs:key>

<xs:keyref name="OrderNoRef" refer="OrderNumberKey">
<xs:selector xpath=".//OrderDetail" />
<xs:field xpath="OrderNo" />
</xs:keyref>
</xs:element>
</xs:schema>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top