W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2000

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

From: Ramesh Gupta <ramesh@eNode.com>
Date: Wed, 11 Oct 2000 08:39:35 -0700
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <B609D7C7.10B9%ramesh@eNode.com>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:47 UTC