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

Re: "xs:all" with minOccurs="0" and maxOccurs="unbounded"

From: Andre Vital Saude <Andre-Vital.Saude@cenpra.gov.br>
Date: Fri, 25 Oct 2002 16:38:32 -0200
Message-ID: <3DB98FA8.8000705@cenpra.gov.br>
To: "Kerz, Antony L" <Antony.Kerz@aetna.com>, "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

I think <xs:choice minOccurs="0" maxOccurs="unbounded"> means the choice 
structure may occur more than once. In your example

> <struct>
>   <struct>
>     <field/>
>   </struct>
>   <field/>
>   <field/>
> </struct>

you have three occurences of the structure choice. First, the "struct" 
element has been *chosen*, then, "field", and last, "field" again.

Now, instead of writing
<xs:choice minOccurs="0" maxOccurs="unbounded">
     <element ref="struct">
     <element ref="field">
</xs:choice>

if I had written
<xs:choice minOccurs="0" maxOccurs="unbounded">
     <element ref="struct" minOccurs="0" maxOccurs="unbounded">
     <element ref="field" minOccurs="0" maxOccurs="unbounded">
</xs:choice>

You would have many other possible combinations. In your example it 
could be three occurences of the structure choice, as before, or it 
could be two occurences of the structure. First one with one "struct" 
element and the second with two "field" elements.

That's the way I understand the spec.

André Saúde



> 
> I got the impression it was for choosing either-or, but not both...
> 
> -----Original Message-----
> From: Andre Vital Saude [mailto:Andre-Vital.Saude@cenpra.gov.br] 
> Sent: Friday, October 25, 2002 1:49 PM
> To: Kerz, Antony L
> Cc: 'xmlschema-dev@w3.org'
> Subject: Re: "xs:all" with minOccurs="0" and maxOccurs="unbounded"
> 
> 
> 
> Hi, Antony,
> 
> your structure seems to be a choice. You do not need many occurences of ALL
> the elements but many occurences of ONE of them. All of your 
> examples are valid for the following structure:
> 
<xs:choice minOccurs="0" maxOccurs="unbounded">
     <element ref="struct">
     <element ref="field">
</xs:choice>
> 
> André Saúde
> 
> Kerz, Antony L wrote:
> 
>>Hi,
>>
>>I am trying to identify a schema for the following structure where, 
>>"struct" elements contain one or more "struct" and/or "field" elements 
>>in any order.
>>
>>Here are some valid examples:
>>
>><struct>
>>  <field/>
>>  <field/>
>></struct>
>>
>><struct>
>>  <struct>
>>    <field/>
>>  </struct>
>>  <field/>
>>  <field/>
>></struct>
>>
>><struct> 
>>  <field/>
>>  <field/>
>>  <struct>
>>    <field/>
>>  </struct>
>>  <field/>
>>  <struct>
>>    <field/>
>>  </struct>
>>  <field/>
>></struct>
>>
>>etc...ad nauseum...
>>
>>what i really want is:
>>
>>"xs:all" with minOccurs="0" and maxOccurs="unbounded"
>>
>>but this isn't allowed cause "xs:all" is intended for exactly one of 
>>each element.
>>
>>Any one have a valid solution for this schema definition?
>>
>>Thanks,
>>Tony.
>>
>>
>>This e-mail, including attachments, is intended for the exclusive use 
>>of
>>the person or entity to which it is addressed and may contain 
>>confidential or privileged information.  If the reader of this e-mail is 
>>not the intended recipient or his or her authorized agent, the reader is 
>>hereby notified that any dissemination, distribution or copying of this 
>>e-mail is prohibited.  If you think that you have received this e-mail 
>>in error, please advise the sender by reply e-mail of the error and then 
>>delete this e-mail immediately.  Thank you.  Aetna
>>
> 
> 
> 
> This e-mail, including attachments, is intended for the exclusive use of the
> person or entity to which it is addressed and may contain confidential or
> privileged information.  If the reader of this e-mail is not the intended
> recipient or his or her authorized agent, the reader is hereby notified that
> any dissemination, distribution or copying of this e-mail is prohibited.  If
> you think that you have received this e-mail in error, please advise the
> sender by reply e-mail of the error and then delete this e-mail immediately.
> Thank you.  Aetna
> 
> 
> 
Received on Friday, 25 October 2002 15:38:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:34 GMT