Re: Is minOccurs>maxOccurs Allowed?

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 UTC