xsd:group, minOccurs and xsd:choice

Hi,

I'm trying to create a group with a choice of a number of elements. I want
the behaviour that at least one of the choice must exist, but can't find a
way in Schema to enforce this.
Here's a fragment of my schema:

  <xs:group name="actions">
    <xs:choice>
      <xs:element name="noaction">
      </xs:element>
      <xs:element name="writevar">
       </xs:annotation>
   </xs:choice>
  </xs:group>
...
  <xs:element name="change">
    <xs:complexType>
      <xs:sequence>
        ...some other elements...
        <xs:element name="do" minOccurs="1" maxOccurs="1">
          <xs:complexType mixed="false">
            <xs:group ref="actions" minOccurs="1" maxOccurs="unbounded"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

This allows the following:
<change>
  <do>
   </do>
</change>

Bizarrely it also allows:
<change>
  <do>
    <boguselement/>
  </do>
 </change>

I want the parser to flag both these examples as erroneous.

Any help would be much appreciated,

Thanks,

Nick Brook
3GLab
UK

Received on Wednesday, 5 February 2003 09:48:45 UTC