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

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 UTC