Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 15th, 2005, 03:20 AM
Authorized User
 
Join Date: Jun 2005
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aldwinenriquez
Default XSD composite key constraint

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!"
__________________
\"Dont you ever give up!\"
 
Old August 15th, 2005, 04:06 AM
Authorized User
 
Join Date: Jun 2005
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aldwinenriquez
Default

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!"
 
Old August 15th, 2005, 04:20 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Violation of PRIMARY KEY constraint??? twyce C# 1 September 9th, 2008 01:23 AM
primary key constraint dhoward VB.NET 2002/2003 Basics 7 July 27th, 2007 09:56 AM
Composite Foreign Key bijgupt SQL Server 2005 6 May 4th, 2007 08:46 AM
Composite key question hlchuah77 SQL Server 2000 3 October 19th, 2004 05:24 AM
Composite primary key evandromoreno Dreamweaver (all versions) 0 July 16th, 2004 02:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.