W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 1999

minOccur,maxOccur

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Tue, 29 Jun 1999 18:39:08 -0600
Message-ID: <61DAD58E8F4ED211AC8400A0C9B468731AADE8@THOR>
To: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Cc: "'petsa@us.ibm.com'" <petsa@us.ibm.com>, "'paul@prescod.net'" <paul@prescod.net>
I know this is probably dredging up old stuff, but.  My initial reaction on
the minOccur, maxOccur was to side with the anti-minOccur/maxOccur comments.
However, I'm starting to lean the other way and see a lot of usefulness to
the minOccur, maxOccur formulation.

First, if we wan't to initially support only the DTD's level of validation,
minOccur could be restricted to (0|1) and maxOccur could be restricted to
(1|*).  This would support all the current occurrence modes but allow the
minOccur/maxOccur form to be used to allow for future enhancement.

Another approach would be to allow the full range of values for
minOccur/maxOccur but only require the processor to validate the most
restrictive of the compatible DTD modes.  That is, minOccur="2" maxOccur="*"
would be validated as "+", etc.

However, for low values of minOccur/maxOccur, it easily maps into DTD
equivalents, so I can't see how it would be a bear to implement.

<elementType name="fred">
	<elementTypeRef name="A" minOccur="2" maxOccur="4"/>
</elementType>

could be expressed in DTD as

<!ELEMENT fred (A,A,A?,A?) >

and 

<elementType name="fred">
	<elementTypeRef name="A" minOccur="2" maxOccur="*"/>
</elementType>

as 

<!ELEMENT fred (A,A+) >

I know this gets silly as N gets large, but we could restrict minOccur to
between 0 and 9 and maxOccur between 1 and 9 and *.

Otherwise, people could kludge the 2-* form in the schema using

<elementType name="fred">
	<seq>
		<elementTypeRef name="A"/>
		<elementTypeRef name="A" occurs="ONEORMORE"/>
	</seq>
</elementType>

But when you add documentation elements, it is going to be awkward to
explain the formulation.

p.s. 
I can see how it would be a bear to implement, if you allowed something like

<choice minOccur=0 maxOccur=20">
	<elementType name="A" minOccur="0" maxOccur="10"/>
	<elementType name="B" minOccur="0" maxOccur="10"/>
</choice>

Where you are intending up to 20 elements from the choice, but at most 10 of
them can be A.  If that was what was intended, I could see how it would be a
bear to implement and see no value in it.
Received on Tuesday, 29 June 1999 20:40:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:46 GMT