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

RE: Elements in group optional and repeatable

From: Pete Johnston <p.johnston@ukoln.ac.uk>
Date: Mon, 4 Mar 2002 22:08:46 -0000
To: "'Jeni Tennison'" <jeni@jenitennison.com>
Cc: xmlschema-dev@w3.org
Message-ID: <011501c1c3c9$2891a140$2392268a@ukoln.ac.uk>
Jeni,

Thanks for the rapid reply!

> So basically it's illegal to provide the minOccurs/maxOccurs 
> attributes on the model groups within the named groups; you 
> need to put these attribute on the *reference* to the group instead:
> 
>   <xs:group ref="elementsGroup" minOccurs="0" maxOccurs="unbounded" />

OK....
 
> Hmm... or, I suppose, you might be able to get around this 
> constraint by putting the xs:choice within a xs:sequence, 
> with something like:
> 
> <xs:group name="elementsGroup">
>   <xs:sequence>
>     <xs:choice minOccurs="0" maxOccurs="unbounded">
>       <xs:element ref="title" />
>       <xs:element ref="creator" />
>       <xs:element ref="subject" />
>     </xs:choice>
>   </xs:sequence>
> </xs:group>
> 
> since it's an XML representation constraint. I'm not certain, though.

I haven't got my head round why this works and I need to test it more
thoroughly, but first impressions are that this seems to do the trick.

Thanks again!

Pete
Received on Monday, 4 March 2002 17:07:38 GMT

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