Re: xsd:group and minOccurs

Hi Jeni,

>I agree with your conclusion, but now with how you got to it. A group
>whose {particles} is empty is a group that doesn't specify any
>particles, for example:
>
>  <xs:sequence />
>
>or:
>
>  <xs:choice />
>
>or:
>
>  <xs:all />
>
>A sequence or an all group with no particles, as above, is fine -- it
>just means that it matches an empty sequence of elements in the
>instance. Having a choice between an empty set of particles is
>invalid, on the other hand, because each time you have a choice you
>must choose something, and if you have nothing to choose from then you
>cannot choose anything :)
>
>A model group like:
>
>  <xsd:choice>
>    <xsd:element name="A" minOccurs="0" type="xsd:string" />
>    <xsd:element name="B" minOccurs="0" type="xsd:string" />
>    <xsd:element name="C" minOccurs="0" type="xsd:string" />
>  </xsd:choice>
>
>is a choice model group that has three element particles. All those
>particles are *optional* (have a minimum occurrence of 0) but the
>model group still has particles. So this is perfectly valid
>(thankfully!).
>
Hmm, yes the above is a perfectly legal schema but was my conclusion 
correct that an instance document which is empty for the above content 
model would be invalid?
Example:

<xsd:element name="Test">
  <xsd:complexType>
    <xsd:choice>
      <xsd:element name="A" minOccurs="0" type="xsd:string" />
      <xsd:element name="B" minOccurs="0" type="xsd:string" />
      <xsd:element name="C" minOccurs="0" type="xsd:string" />
    </xsd:choice>
  </xsd:complexType>
</xsd:element>

Would an instance document that only has:

<Test/>

be valid or invalid?

If this is valid then can you give an example where the above rule that "having a choice between an empty set of particles is invalid" is broken?

Thanks,
/Eddie

>/ 
>
>Cheers,
>
>Jeni
>
>---
>Jeni Tennison
>http://www.jenitennison.com/
>
>  
>

Received on Thursday, 29 August 2002 20:04:46 UTC