W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2002

Re: Is minOccurs>maxOccurs Allowed?

From: Jeni Tennison <jeni@jenitennison.com>
Date: Thu, 13 Jun 2002 15:45:08 +0100
Message-ID: <28-2135823862.20020613154508@jenitennison.com>
To: "Dwivedi , Ajay Kumar" <AjayKumar.Dwivedi@Dresdner-Bank.com>
CC: xmlschema-dev@w3.org

Hi Ajay,

>>   2 If {max occurs} is not unbounded, that is, it has a numeric value,
>>     then all of the following must be true:
>>     2.1 {min occurs} must not be greater than {max occurs}.
>>     2.2 {max occurs} must be greater than or equal to 1.
>
> However, the Part 1 says :
>
> if the <element> element information item has <complexType> or
> <group> as an ancestor and the ref [attribute] is absent, the
> corresponding schema components are as follows (unless
> minOccurs=maxOccurs=0, in which case the item corresponds to no
> component at all): (just above
> http://www.w3.org/TR/xmlschema-1/#Particle_details)

Yes, but that's talking about how to map from the XML representation
(xs:element element with minOccurs/maxOccurs attributes) to the
abstract schema component (the particle). It says that if maxOccurs is
0 and minOccurs is 0 then the xs:element element doesn't map to
anything -- no particle is created.

The Schema Component Constraint that I quoted is a constraint on the
schema component -- the particle itself. Of course, if there's no
particle, the constraint doesn't apply because there's nothing for it
to apply to. You can't, from an XML representation of a schema, create
a particle whose {min occurs} and {max occurs} is zero. You can create
one whose {min occurs} is 1 and whose {max occurs} is zero, on the
other hand, but that isn't legal.

> Also, shouldn't the maxOccurs be defined as (positiveInteger |
> unbounded) since the above requirements apply to all particles.

I'm inclined to agree with you -- there doesn't seem to be much point
allowing users to include XML representations for things that don't
get carried through to the schema component level. Perhaps the WG felt
that this way would make it easier for people to "comment out"
particles by giving them minOccurs=maxOccurs=0 attributes, I don't
know.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Thursday, 13 June 2002 10:45:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:31 GMT