Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Interdependence between fields

From: "Adrian Iacob" <adrian.iacob@-----.--->
To: xmlschema-dev@--.---
Date: 11/16/2007 10:36:00 AM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent