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 13:28:50 +0200
Message-ID: <39E44EF2.D05EAEB8@dyomedea.com>
To: Miloslav Nic <nicmila@idoox.com>
CC: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Miloslav Nic wrote:
> 
> I am an idiot :(((((

No, you're not !

> I have meant xsd:all and therefore:
> 
> <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 :)

Even if it validates with XSV (I have also tested it), according to the
spec, it shouldn't !

The primer [1] is very formal about the fact that maxOccurs cannot be
greater than 1 for elements appearing within "all" particles...

[1] http://www.w3.org/TR/xmlschema-0/#ref18

> 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
> > ------------------------------------------------------------------------
> 
> --
> ******************************************
> <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:36:52 UTC

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