[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Is it valid in XSD to have choice where all particlesare o

  • From: Michael Kay <mike@saxonica.com>
  • To: xml-dev@lists.xml.org
  • Date: Thu, 15 Dec 2011 15:21:24 +0000

Re:  Is it valid in XSD to have choice where all particlesare o
On 15/12/2011 14:56, Jirka Kosek wrote:
> Hi,
>
> I have came across interesting problem in XSD. Assume the following
> snippet of XML schema:
>
> <xs:complexType name="foo">
>    <xs:sequence>
>      ...
>      <xs:choice>
>        <xs:element name="a" minOccurs="0"/>
>        <xs:element name="b" minOccurs="0"/>
>      </xs:choice>
>      ...
>    </xs:sequence>
> </xs:complexType>
>
> I have tried several validator and none of them reports error witch such
> schema. However in section "3.8.4 Model Group Validation Rules" in XML
> Schema Part 1 there is written:
>
> "Nothing in the above should be understood as ruling out groups whose
> {particles} is empty: *although no sequence can be ·valid· with respect
> to such a group whose {compositor} is choice*, the empty sequence is
> ·valid· with respect to empty groups whose {compositor} is sequence or all."
That's saying you can write

<xs:choice minOccurs="1"/>

meaning there's a menu of options to choose from, and you've got to 
choose something, but the list of options to choose from is empty; so 
nothing can be valid against the choice.

Or to put it another way, it's like having a condition nextElement = 
oneOf(a,b,c) where the list a,b,c is empty and the condition is 
therefore always false.
>
> Should this be understood as that above fragment of XSD is incorrect? In your fragment, the list of particles inside the choice is not empty.
No.

Michael Kay


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.