[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Question on id constraints
Hi John, Let me see if I can shed some light on the key, unique and keyref issue. I'm trying to decipher the schema spec on identity contstraint validity, but perhaps someone can save me a few hours and a few aspirin.No, the key declaration doesn't need to be declared physically before the keyref declaration. The rule is that the scoping element for the key (or unique) declaration must be the same as OR a descendant of the scoping element for the keyref declaration. This means that the following is correct (not complete XML Schema syntax!): <xs:element name="root"> <xs:element name="sub" type="whatever">
<xs:keyref name="keyref" refer="key">
</xs:element> The scoping element for the key declaration is a descendant of the scoping element for the keyref declaration. However this is not allowed: <xs:element name="root"> <xs:element name="sub" type="whatever">
<xs:key name="key">
</xs:element> 2. Is pk required to be defined on the same element as ref, or on a descendant or anscetor of it, or just anywhere in the same schema?The same as OR a descendant. Cheers,
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|