Purpose of xs:unique's name attribute

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 UTC