- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 01 Feb 2001 09:56:42 +0000
- To: "Weber, Heiko" <Heiko.Weber@softwareag.com>
- Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
"Weber, Heiko" <Heiko.Weber@softwareag.com> writes: > Hello, > > as I was reading through the XML Schema 1 Specification I found > a section which said: > > "If maxOccurs is not unbounded, that is, it has a numeric value, then > maxOccurs must [be] greater than or equal to 1" > > on the other hand, I found "minOccurs=maxOccurs=0", for example: > > "otherwise 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):" > > So, can maxOccurs take the value 0 or not? I'm a little confused here. > Am I misunderstanding something? Both are true, but you must keep track of the difference between a component and its XML representation, to understand why. Particle components have a {maxOccurs} property, which must be >=1 or _unbounded_. The first quote you give above is from the formal constraint on particles [1] which enforces this. Element information items in the XML representation of schemas may have a 'maxOccurs' attribute, which may be 0 to effectively remove an optional element during derivation of a type definition by restriction. The second quote you give above is from the description of the mapping from EII to component [2], which actually fits perfectly with the component constraint: if the attribute is 0, there _is_ no corresponding component, so the constraint is not violated. Hope this helps. ht [1] http://www.w3.org/TR/xmlschema-1/#p-props-correct [2] http://www.w3.org/TR/xmlschema-1/#declare-element -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh W3C Fellow 1999--2001, part-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/
Received on Thursday, 1 February 2001 04:56:45 UTC