W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2002

RE: xs:all - why is minOccurs, maxOccurs restricted to "0" or "1" for child xs:element ?

From: Gary Cramblitt <garycramblitt@comcast.net>
Date: Thu, 28 Mar 2002 20:46:04 -0500
To: xmlschema-dev@w3.org
Message-id: <3CA3810C.30063.2890B7@localhost>
On 28 Mar 2002 at 14:24, dbowen@es.com wrote:

> Thanks Jeni, you're great!
> 
> >> The problem is that minOccurs and maxOccurs for <xs:element> under
> >> <xs:all> have to be "0" or "1". It seems that the Schema's
> >> definition of <xs:group name="allModel"> ... is the part that's
> >> placing this restriction. Is there some fundamental reason why
> >> <xs:all> places such restrictions on the child element's minOccurs
> >> and maxOccurs? Or is there another way to define the schema to have
> >> the same effect that I'm after?
> >
> >There's no way of expressing the constraints that you're after on a
> >content model using XML Schema alone. I'm not sure about the rationale
> >for this restriction, but I think it's something to do with the
> >semantics of an xs:all that contains particles with a maxOccurs
> >greater than one being ambiguous (does it mean that the elements of
> >the same type have to be next to each other or not? - in your case
> >not, in other cases it does).

If I'm not mistaken, this restriction on xs:all means it is impossible 
to write an XML-Schema for XHTML.  Try to define the <body> 
element for example...  There is a group working on modular 
definitions, supposedly to permit more flexibility as the XHTML 
spec evolves, but I also suspect because there is no other way to 
do it.  I'd be happy if somebody could prove me wrong.

--
Gary Cramblitt
garycramblitt@comcast.net
Received on Thursday, 28 March 2002 20:46:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT