[standards-jig] sequence vs. choice

David Waite mass at akuma.org
Thu Feb 7 18:13:23 UTC 2002


Fabrice DESRE wrote:

>>Peter Saint-Andre wrote:
>>
>
>>XML schemas question: can do the following to override the maxOccurs
>>on
>>the <xsd:choice/> element?
>>
>>     <xsd:choice minOccurs='0' maxOccurs='1'>
>>       <xsd:element ref='body' />
>>       <xsd:element ref='subject' />
>>       <xsd:element ref='thread' />
>>       <xsd:any namespace='##any' minOccurs='0' maxOccurs='unbounded'
>>/>
>>       <xsd:element ref='error' />
>>     </xsd:choice>
>>
>
> Not the way you intend I think. The above schema allows anything inside
>the <message/> element, just because of
><xsd:any namespace='##any' minOccurs='0' maxOccurs='unbounded'/>
>My understanding is that we want allow any element that a local name
>value of 'x', in any namespace. Am I wrong ?
>
I don't know if the name value has to be 'x' (I don't see that), but it 
does allow any element within the current namespace. Perhaps ##other is 
appropriate?

>
>
> Moreover, this schema doesn't allow a <message/> to contain both
>a <body/> and a <subject/> !!
>
The minOccurs and maxOccurs should be on each element, right?

>
> I'll try to come up with something for the message schema and I'll post
>it there.
>
Very cool :-)

-David Waite




More information about the Standards mailing list