Interdependence between fields

I have an interdependence between 2 fields value like this: One field is
country and the second is town. First field can have USA, Canada, Mexic. The
second can have for example Montreal, Toronto, New York, Washington, Boston,
Veracruz.

xml ok:
<myxml>
  <country>Canada</country>
  <town>Montreal</town>
</myxml>

<myxml>
  <country>USA</country>
  <town>Washington</town>
</myxml>

xml *not ok

*<myxml>
  <country>USA</country>
  <town>Veracruz</town>
</myxml>

<myxml>
  <country>Canada</country>
  <town>New York</town>
</myxml>

I could restrict that the country has only contries and town has only towns
like this:

<xs:element name="country" >
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Canada"/>
      <xs:enumeration value="USA"/>
      <xs:enumeration value="Mexic"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>

Montreal, Toronto, New York, Washington, Boston, Veracruz.
 <xs:element name="town" >
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Montreal"/>
      <xs:enumeration value="Toronto"/>
      <xs:enumeration value="New York"/>
      <xs:enumeration value="Washington"/>
      <xs:enumeration value="Boston"/>
      <xs:enumeration value="Veracruz"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>

*My question:
*How can I restrict that Canada is allowed with Montreal and Toronto, USA is
with New York, Washington or Boston and Mexic is allowed only with Veracruz.



Please Help.
Thanks Adrian

Received on Friday, 16 November 2007 14:47:52 UTC