This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17140 - Component model: maxOccurs is non-negative
Summary: Component model: maxOccurs is non-negative
Status: RESOLVED INVALID
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.1 only
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: David Ezell
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-21 15:44 UTC by Michael Kay
Modified: 2012-05-31 08:43 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2012-05-21 15:44:56 UTC
In 3.9.1, the Particle schema component, we read:

{max occurs}
Either a positive integer or unbounded. Required.

I believe it should be

{max occurs}
Either an xs:nonNegativeIntegerValue or unbounded. Required.
Comment 1 C. M. Sperberg-McQueen 2012-05-30 21:49:39 UTC
0 should be legal as the value of maxOccurs in a schema document, but if I understand the XML mapping rules of the spec correctly, an XML construct with maxOccurs = 0 should not turn into any schema component at all.   

In 3.3.2, for example, a propos of element elements, the final bullet item in a list of pointers to mapping rules says "If the <element> element information item has minOccurs=maxOccurs=0, then it maps to no component at all."  3.7.2 makes the same point for group elements: "Otherwise, the <group> has minOccurs=maxOccurs=0, in which case it maps to no component at all."  3.8.2 applies the same principle to all, choice, and sequence elements: "Each of the above items corresponds to a particle containing a model group, with properties as follows (unless minOccurs=maxOccurs=0, in which case the item corresponds to no component at all):"  And 3.10.2 gives the same rule for wildcards:  "An <any> information item corresponds both to a wildcard component and to a particle containing that wildcard (unless minOccurs=maxOccurs=0, in which case the item corresponds to no component at all)." I think that's all the elements that are allowed to carry maxOccurs attributes.

Allowing maxOccurs="0" on XML representations of particles makes sense in the context of the original design of restriction in XSD 1.0, as a way of preserving a structural isomorphism between the XML description of the base type and the XML description of the restriction.
Comment 2 Michael Kay 2012-05-31 08:43:14 UTC
Fair enough.