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

Purpose of xs:unique's name attribute

From: <jddahl@micron.com>
Date: Tue, 27 Jan 2004 16:35:03 -0700
Message-ID: <698E379DD547F346AD4F217BD0B2A0D6061679@ntxboimbx05.micron.com>
To: <xmlschema-dev@w3.org>

In the example, report.xsd (http://www.w3.org/TR/xmlschema-0/#report.xsd),

  <unique name="dummy1">
   <selector xpath="r:regions/r:zip"/>
   <field xpath="@code"/>
  </unique>

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?

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?

Thanks,
Jeff Dahl
Received on Tuesday, 27 January 2004 18:35:14 GMT

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