views:

1114

answers:

2

I am in need of a case insensitive string enumeration type in my XML schema (.xsd) file. I can get case insensitive by doing the following.

<xs:simpleType name="setDigitalPointType">
 <xs:restriction base="xs:string">
  <xs:pattern value="[Oo][Nn]" />
  <xs:pattern value="[Oo][Ff][Ff]" />
 </xs:restriction>
</xs:simpleType>

The only problem is that I get no enumeration values. I will not get the nice intellesense when using Visual Studio to write my XML. The following will give me enumerations but it is case sensitive.

<xs:simpleType name="setDigitalPointType">
 <xs:restriction base="xs:string">
  <xs:enumeration value="on" />
  <xs:enumeration value="off" />
 </xs:restriction>
</xs:simpleType>

This will give me my enumerations but if I ever receive a value of "On", "ON", or "oN" it will fail verification.

I want enumeration of "on", "off" and allow entry of case insensitive versions.

A: 

Well, you could just list all the permutations as patterns :)

leppie
I could but this isn't elegant for long enumeration values like "notification" and I still don't get my enumeration. The enumeration is very important for me. :)
Bobby Cannon
+1  A: 

IBM developerWorks has an article on how to use XSLT to perform the construction of the full set of enumeration alternatives in an automated fashion. It is presented as a workaround to the lack of case-insensitive enumerations.

joel.neely