In my schema I have 2 enumerations, let's say, country description and
country code, and I want to use them so I can map each country
description to its precise country code (and no other).
So far I've seen I can define both keys for description and code, but
my XMLs validate even if I choose a wrong pair:
Here are my both enumerations (abbreviated)
<xs:simpleTyp e name="COUNTRYCO DE">
<xs:restricti on base="xs:int">
<xs:enumerati on value="4"/>
<xs:enumerati on value="8"/>
<xs:enumerati on value="958"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleTyp e name="COUNTRYDE SC">
<xs:restricti on base="xs:string ">
<xs:maxLength value="40"/>
<xs:enumerati on value="Afghanis tan"/>
<xs:enumerati on value="Albania"/>
<xs:enumerati on value="Germany"/>
</xs:restriction>
</xs:simpleType>
And I use the "country" element as follows:
<xs:element name="COUNTRY">
<xs:complexType >
<xs:sequence>
<xs:element name="name" type="COUNTRYDE SC"/>
<xs:element name="value" type="COUNTRYCO DE"/>
</xs:sequence>
</xs:complexType>
</xs:element>
How should I define the map and the keys, etc. so that something like
this validates:
<COUNTRY>
<COUNTRYDESC>Ge rmany</COUNTRYDESC>
<COUNTRYCODE>95 8</COUNTRYCODE>
</COUNTRY>
But this DOES NOT validate (as it's a wrong description-code pair):
<COUNTRY>
<COUNTRYDESC>Af ghanistan</COUNTRYDESC>
<COUNTRYCODE>95 8</COUNTRYCODE>
</COUNTRY>
I'll be very grateful for any help!