Variation depending on attribute value

Hi all,

Given the below schema, is it possible to specify that if the attribute
"Type" equals "Double" then the element "WithDoubleBed" is required, i.e.
minOccurs="1", and if it equals "DoubleOneChild" then the element "ChildAge"
is required?

Thanks in advance,
Camilla


<?xml version="1.0" encoding="windows-1252"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema">

<element name="TestRoom">
   <complexType>
	<all>

        <element name="Room">
          <complexType>

            <all>
              <element name="WithDoubleBed" type="string" minOccurs="0"/>
              <element name="ChildAge" type="integer" minOccurs="0"/>
            </all>

            <attribute name="Type" use="required">
              <simpleType>
                <restriction base="string">
                  <enumeration value="Single"/>
                  <enumeration value="Double"/>
                  <enumeration value="DoubleOneChild"/>
                </restriction>
              </simpleType>
            </attribute>

          </complexType>
        </element>

	</all>
   </complexType>
</element>

</schema>

Received on Monday, 4 August 2003 07:20:27 UTC