W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2003

Re: allowing zero to unbounded elements in any order?

From: Jeni Tennison <jeni@jenitennison.com>
Date: Sat, 15 Mar 2003 00:04:07 +0000
Message-ID: <132560690360.20030315000407@jenitennison.com>
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 am bound by using straight xsd, without any other utilities. I'm
> not sure what you refer to as a loose content model,

One in which you have a zero-or-more choice between all the elements
that can be present, meaning that they can all be present in any
order, any number of times. It's loose in that it allows more than you
actually want to allow.

> I tried your 3rd alternative, but unsuccessfully. Being relatively
> new to schema's, I could have just missed something. Here is an
> example of what I'm doing now, with <xsd:sequence> :
>         <xsd:complexType name="Type_LotSummary">
>                 <xsd:complexContent>
>                         <xsd:extension base="Type_ToolLotSummary">
>                                 <xsd:sequence minOccurs="0" maxOccurs="1">
>                                         <xsd:element name="NumWafers"
> type="xsd:nonNegativeInteger" minOccurs="1" maxOccurs="1"/>
>                                         <xsd:element name="Wafers"
> type="WaferLocations" minOccurs="1" maxOccurs="1"/>
>                                 </xsd:sequence>
>                         </xsd:extension>
>                 </xsd:complexContent>
>         </xsd:complexType>
>         <xsd:complexType name="WaferLocations">
>                 <xsd:sequence minOccurs="0" maxOccurs="1">
>                         <xsd:element name="WaferLoc"
> type="xsd:normalizedString" minOccurs="0" maxOccurs="unbounded"/>
>                 </xsd:sequence>
>         </xsd:complexType>
> Where <Type_ToolLotSummary> contains about 40 different element
> tags, that my users want to be in any order (as well as some being
> optional), as well as <NumWafers> and <Wafers>, which contains one
> or more <WaferLoc> tags. Once I replaced <xsd:sequence> with
> <xsd:all>, a cascading waterfall of problems started popping up.

Hmm... you should be able to replace the <xs:sequence> with an
<xs:all> (you need to get rid of the minOccurs="0", though). As long
as the <xs:all> appears exactly once and only contains elements that
appear zero-or-one times, then you should be fine.

> I'm just assuming that it isn't possible with straight xsd.

That's very possible. It's easy to get to the limits of XML Schema's
support for elements-in-any-order.



Jeni Tennison
Received on Friday, 14 March 2003 19:04:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:09 UTC