Re: allowing zero to unbounded elements in any order?

Hi Michael,

> I'm confused. Isn't the
>
>         "minOccurs=0"
>
> just what is telling the schema that this particular element that
> it's optional?

In:

  <xs:sequence minOccurs="0">
    <xs:element name="NumWafers" type="xsd:nonNegativeInteger" />
    <xs:element name="Wafers" type="WaferLocations" />
  </xs:sequence>

the sequence as a whole is optional. You are saying that *either* you
have a sequence comprising a <NumWafers> element followed by a
<Wafers> element, or you have nothing at all. If you want to say that
a particular element is optional, use minOccurs="0" on the
<xs:element> element for that element.

I was actually misremembering the spec; putting minOccurs="0" on an
<xs:all> element is fine. You should be able to do:

  <xs:all minOccurs="0">
    <xs:element name="NumWafers" type="xsd:nonNegativeInteger" />
    <xs:element name="Wafers" type="WaferLocations" />
  </xs:all>

in order to get <NumWafers> and <Wafers> to appear in any order.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Saturday, 15 March 2003 06:39:03 UTC