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

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

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Wed, 11 Oct 2000 13:06:46 +0200
Message-ID: <39E449C6.8DA131A8@dyomedea.com>
To: Miloslav Nic <nicmila@idoox.com>
CC: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
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:09:14 UTC

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