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

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

From: Martin J. Duerst <duerst@w3.org>
Date: Wed, 11 Oct 2000 20:33:36 +0900
Message-Id: <4.2.0.58.J.20001011203121.00cefb50@sh.w3.mag.keio.ac.jp>
To: Eric van der Vlist <vdv@dyomedea.com>, Miloslav Nic <nicmila@idoox.com>
Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Probably what Nic wants is something like

> > <xsd:element name="XXX">
> > <xsd:complexType>
> > <xsd:all>
> >         <xsd:element name="aaa" maxOccurs="2"/>
> >         <xsd:element name="bbb" maxOccurs="2"/>
> > </xsd:any>
> > </xsd:complexType>
> > </xsd:element>

which is currently impossible because xsd:all only allows
maxOccurs up to 1. It would be rather easy to extend that,
though.

Regards,   Martin.


At 00/10/11 13:06 +0200, Eric van der Vlist wrote:
>Hi Nic,
>
>xsd:any is a very specific beast:
>
>"In general, an any element specifies that any well-formed XML is
>permissible in a type's content model"
>
>and it doesn't accept xsd:element as its content.
>
>My understanding is that you have to use a combinaison of the 3
>following elements to try to achieve what you want here:
>
>xsd:sequence (imposing an order for your elements).
>xsd:choice (one of the items only)
>xsd:all (several restrictions such as maxOccurs for each of the elements
>can only be <= 1).
>
>I may have missed something (I hope so ;) but I don't see how you can
>achieve declaring (at least in an extensible way) that both aaa and bbb
>have to be present between 0 to 2 times in any order with the current
>draft !
>
>The only way I can think of is a xsd:choice between a xsd:sequence for
>each combinaison.
>
>Hope this helps.
>
>Eric
>
>Miloslav Nic wrote:
> >
> > In my understanding, if I use:
> >
> > <xsd:element name="XXX">
> > <xsd:complexType>
> > <xsd:any>
> >         <xsd:element name="aaa" maxOccurs="2"/>
> >         <xsd:element name="bbb" maxOccurs="2"/>
> > </xsd:any>
> > </xsd:complexType>
> > </xsd:element>
> >
> > Then this xml file vould be schema valid:
> >
> > <XXX>
> >    <aaa/>
> >    <bbb/>
> >    <aaa/>
> >    <bbb/>
> > </XXX>
> >
> > Am I correct?
> >
> > --
> > ******************************************
> > <firstName> Miloslav </firstName>
> > <surname>   Nic      </surname>
> >
> > <mail>    nicmila@idoox.com    </mail>
> > <support> http://www.zvon.org  </support>
> > <zvonMailingList>
> >     http://www.zvon.org/index.php?nav_id=4
> > </zvonMailingList>
>
>--
>------------------------------------------------------------------------
>Eric van der Vlist       Dyomedea                    http://dyomedea.com
>http://xmlfr.org         http://4xt.org              http://ducotede.com
>------------------------------------------------------------------------
Received on Wednesday, 11 October 2000 07:33:05 UTC

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