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

Discussion in 'XML' started by robin.guest@gmail.com, May 22, 2005.

  1. 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?
     
    , May 22, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tee
    Replies:
    3
    Views:
    7,907
    Herfried K. Wagner [MVP]
    Jun 23, 2004
  2. Markus
    Replies:
    1
    Views:
    1,665
    Markus
    Nov 23, 2005
  3. FC
    Replies:
    4
    Views:
    6,013
    Keith Davies
    Oct 27, 2003
  4. Replies:
    1
    Views:
    2,548
    Mark P
    Apr 6, 2007
  5. Xah Lee
    Replies:
    4
    Views:
    1,043
Loading...

Share This Page