Question on "minOccurs" within element declarations

Greetings, all.

In section 3.4.9, dealing with <element> declarations, the minOccurs
attribute for an <element> can only be "1" or (presumably) not be present at
all to indicate no minimum occurrence restriction.  (The examples indicate
that minOccurs can be explicitly included with a "0" value, although the
formal grammar does not indicate this.)  But why must the attribute value
stop at "1"?  Certain applications may call for some minimum number of
occurrences greater than 1.  Consider XML data that tracks bus routes by
bus, arranged as follows.  (Details for each stop location may be stored
separately, e.g. in top-level <site> elements.)


<bus id="METSOU-037" name="Metro South">
	<location arrive="09:36" depart="09:38" site="5TH-026" />
	<location arrive="09:42" depart="09:44" site="MAIN-019" />
	<!-- Additional location codes -->
</bus>


In order for a bus to have a route, it must go between at least TWO
locations, so at least two <location> elements need to be included.  The XML
Schema should be able to enforce this.  An example (abbreviated) schema
would be:


<archetype name="bus">
	<element name="location" minOccurs="2">
		<!-- Embedded archetype for element "location" -->
	</element>
</archetype>


Simon, is this similar to what you were referring to you in your P.S.?
(Ref. message ID
3D808EC801AED111B0100008C75D5DDCF0BB55@roc05bxgeisge.is.ge.com, November 23,
1999.)


Best regards,
Jamieson Christian
TRW Systems & Information Technology Group
mailto:Jamieson.Christian@trw.com


NOTE: The opinions expressed herein are solely those of the author and do
not necessarily reflect the views or opinions of TRW.

Received on Wednesday, 24 November 1999 15:47:51 UTC