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: Eric van der Vlist <vdv@dyomedea.com>
Date: Wed, 11 Oct 2000 17:49:57 +0200
Message-ID: <39E48C25.B2C1588B@dyomedea.com>
To: Ramesh Gupta <ramesh@eNode.com>
CC: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
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

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