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

relax xs:all restriction of child elements having minOccurs 0 or 1 and maxOccurs 0 or 1

From: <dbowen@es.com>
Date: Fri, 5 Apr 2002 13:18:44 -0700
Message-ID: <AFE3FBA300B6F04282BE07949DB2E123A4185A@TORINO.corp.es.com>
To: <www-xml-schema-comments@w3.org>
Please do not force child elements of xs:all to be restricted to having minOccurs or maxOccurs only be "0" or "1".  This restriction seems to currently be in force due to the definition of the "allModel" group.

Currently, its possible to allow a set of children to show up any number of times and in any order using a construct like:

<xs:choice minOccurs="0" maxOccurs="unbounded">
	<xs:element ref="e1" minOccurs="0" maxOccurs="unbounded"/>
	<xs:element ref="e2" minOccurs="0" maxOccurs="unbounded"/>
	<xs:element ref="e3" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>

and its possible to have the minOccurs and maxOccurs to something besides 1 if you don't mind keeping the order preserved:

<xs:sequence>
	<xs:element ref="e1" minOccurs="1" maxOccurs="2"/>
	<xs:element ref="e2" minOccurs="3" maxOccurs="4"/>
	<xs:element ref="e3" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>

What XML Schema needs is a straight forward way of saying "I don't care in what order the child elements show up, but these are the child elements that are legal". xs:all could be used to do that with something like:

<xs:all>
	<xs:element ref="e1" minOccurs="1" maxOccurs="2"/>
	<xs:element ref="e2" minOccurs="3" maxOccurs="4"/>
	<xs:element ref="e3" minOccurs="0" maxOccurs="unbounded"/>
</xs:all>

As it is in XML Schema 1.0, xs:all is not nearly as useful as it could be (http://www.w3.org/2001/XMLSchema.xsd doesn't even use it!!!!).

Please seriously consider this, or something like it for XML Schema 1.1.


Thanks!
-Daniel
Received on Friday, 5 April 2002 15:19:15 GMT

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