Re: xsd:all and xsd:element with max(min)occurs (was: xsd:any ...)

Ramesh,

Ramesh Gupta wrote:
> 
> To achieve the effect you want, try (using 4/7 draft):
> <xsd:element name="XXX">
>     <xsd:complexType>
>         <group  ref="aORb" minOccurs="0" maxOccurs="2"/>
>     </xsd:complexType>
> </xsd:element>
> 
> <group  name="aORb">    <!-- allow only <aaa> or <bbb> or both -->
>     <sequence>
>         <xsd:element name="aaa" minOccurs="0" maxOccurs="1"/>
>         <xsd:element name="bbb" minOccurs="0" maxOccurs="1"/>
>     </sequence>
> </group>
> 
> Ramesh

You can also achieve it without using a group:

<xsd:element name="XXX">
     <xsd:complexType>
     <xsd:sequence  minOccurs="0" maxOccurs="2">
         <xsd:element name="aaa" minOccurs="0" maxOccurs="1"/>
         <xsd:element name="bbb" minOccurs="0" maxOccurs="1"/>
     </sequence>
    </xsd:complexType>
 </xsd:element>

but I guess that Nic would also have liked that 

> <XXX>
> <aaa/>
> <aaa/>
> <bbb/>
> <bbb/>
> </XXX>

passes through this schema which isn't the case here since you don't
have twice the sequence.

Eric

-- 
------------------------------------------------------------------------
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
------------------------------------------------------------------------

Received on Wednesday, 11 October 2000 11:49:29 UTC