Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - RE: Java code generation from XSD and its use.... >Thread Next - whiteSpace facet Interdependence between fieldsTo: 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
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
