XML schema - case-insensitive xs:unique? - newbie question

R

robin.guest

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="."/>
</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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top