XML Schema: Validating xsd:choice against another element in

webmasterbeta

New Member
Hi:I need to understand how I can validate the xsd:element choosen in an xsd:choiceto another element in the schema. Below is part of my schema.<?xml version="1.0" encoding="UTF-8" ?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:simpleType name="stCommand"><xsd:restriction base="xsd:string"><xsd:enumeration value=http://forums.devx.com/archive/index.php/"Choce1" /><xsd:enumeration value="Choice2" /></xsd:restriction></xsd:simpleType><xsd:element name="Document1"><xsd:complexType><xsd:sequenece><xsd:element name="Command" type="stCommand"/><xsd:choice><xsd:element name="Data1" type="xsd:string"/><xsd:element name="Data2" type="xsd:date"/><xsd:choice><xsd:sequenece></xsd:complexType></xsd:element></xsd:schema>What I would like to see happen, is as follows. When Command = Choice1,then the choice must be Data1. When Command = Choice2, then the choice mustbe Data2.How can I enforce this constraint using XML Schemas?ThanksMarc:o)
 
Back
Top