W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2004

RE: Purpose of xs:unique's name attribute

From: Michael Kay <mhk@mhk.me.uk>
Date: Wed, 28 Jan 2004 09:38:23 -0000
To: <jddahl@micron.com>, <xmlschema-dev@w3.org>
Message-ID: <005401c3e582$79a12920$6401a8c0@pcukmka>

> what is the purpose of the name attribute-- "dummy1"?
> 
> Is it possible to reference this uniqueness restraint?  If 
> so, how?  Is there a xs:uniqueref element?

An xs:keyref can reference either an xs:key constraint or an xs:unique
constraint. 

> 
> I have the following schema:
> 
>     <xs:element name="type1" type="type_group"/>
>     <xs:element name="type2" type="type_group"/>
>     <xs:element name="type3" type="type_group"/>
> 
> where "type_group" is a named xs:complexType.  How can I 
> associate a uniqueness constraint within each element?
> 
> Of course, I could define:
> 
>     <xs:element name="type1" type="type_group">
> 	  <unique ...>
> 		...
> 	  </unique>
>     </xs:element>    
>     <xs:element name="type2" type="type_group">
> 	  <unique ...>
> 		...
> 	  </unique>
>     </xs:element>
>     <xs:element name="type3" type="type_group">
> 	  <unique ...>
> 		...
> 	  </unique>
>     </xs:element>
> 
> but that seems redundant.  Is it possible to reference a 
> "named" uniqueness constraint?
> 
I think you have to do what you've shown above.

Michael Kay
Received on Wednesday, 28 January 2004 04:37:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:41 GMT