|
Subject:
|
XSD composite key constraint
|
|
Posted By:
|
aldwinenriquez
|
Post Date:
|
8/15/2005 3:20:50 AM
|
How do I implement composite key constraint for an xsd element I have. Basically I need to ensure that the two attributes (USERID and COURSEID) cannot be duplicated in the xml that I have.
How do I do that?
Aldwin Enriquez "Dont you ever give up!"
|
|
Reply By:
|
aldwinenriquez
|
Reply Date:
|
8/15/2005 4:06:47 AM
|
I got it guys..I used xs:key element..
<xs:key name="unq_USER_COURSE"> <xs:selector xpath="Courses"/> <xs:field xpath="@USERID"/> <xs:field xpath="@COURSEID"/> </xs:key>
Aldwin Enriquez "Dont you ever give up!"
|
|
Reply By:
|
mhkay
|
Reply Date:
|
8/15/2005 4:20:23 AM
|
Use an xsd:unique element with more than one xsd:field child; the combination of all the xsd:field's defines the composite key.
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|