- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Sat, 15 Mar 2003 11:38:49 +0000
- To: "Scott, Michael Gordon" <Michael.Gordon.Scott@kla-tencor.com>
- CC: Sam Carleton <sam@linux-info.net>, xmlschema-dev <xmlschema-dev@w3.org>
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