W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2005

Case-insensitive xs:unique?

From: Threetwosevensixseven <32767@despammed.com>
Date: Sun, 22 May 2005 00:57:38 +0100
Message-Id: <22A6431C-029B-4F0F-87B5-E808DABAC980@despammed.com>
To: xmlschema-dev@w3.org

I have this in my schema file:

<xs:element name="ListOfNames">
   <xs:complexType>
     <xs:sequence>
       <xs:element ref="CaseInsensitiveName"
       minOccurs="0" maxOccurs="unbounded"/>
     </xs:sequence>
   </xs:complexType>
   <xs:unique name="UniqueNames">
     <xs:selector xpath="CaseInsensitiveName"/>
     <xs:field xpath="text(.)"/>
   </xs:unique>
</xs:element>

<xs:element name="CaseInsensitiveName">
   <xs:simpleType>
     <xs:restriction base="xs:string">
       <xs:minLength value="1"/>
       <xs:maxLength value="24"/>
     </xs:restriction>
   </xs:simpleType>
</xs:element>


and this in my instance document:

<ListOfNames>
   <CaseInsensitiveName>John</CaseInsensitiveName>
   <CaseInsensitiveName>Fred</CaseInsensitiveName>
   <CaseInsensitiveName>fred</CaseInsensitiveName>
</ListOfNames>

Using:

xmlns:xs="http://www.w3.org/2001/XMLSchema" and
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

This validates, unless I add a second "Fred" when the case-sensitive  
unique constraint kicks in.

But is there a way to make the unique constraint case-insensitive, so  
that the example above is invalid because both "Fred" and "fred" are  
present?
Received on Sunday, 22 May 2005 10:12:26 GMT

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