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

on 10/11/00 4:16 AM, Miloslav Nic at nicmila@idoox.com wrote:

> <xsd:element name="XXX">
> <xsd:complexType>
> <xsd:all>
> <xsd:element name="aaa" maxOccurs="2"/>
> <xsd:element name="bbb" maxOccurs="2"/>
> </xsd:all>
> </xsd:complexType>
> </xsd:element>
> 
> 
> Is now:
> 
> <XXX>
> <aaa/>
> <bbb/>
> <aaa/>
> <bbb/>
> </XXX>
> 
> valid :)

No. but the following is:
<XXX>
    <aaa/>
    <aaa/>
    <bbb/>
    <bbb/>
<XXX>

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

Received on Wednesday, 11 October 2000 11:39:25 UTC