RE: Elements in group optional and repeatable

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 UTC