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

RE: inquiry into the <choice> element behavior

From: Alex Porras <alex.porras@dds.mediaocean.com>
Date: Fri, 31 Oct 2008 10:28:46 -0400
Message-ID: <490B161E.8060809@dds.mediaocean.com>
To: xmlschema-dev@w3.org
RE: inquiry into the <choice> element behavior

Michael,

Thanks for your prompt response.  If you could be so kind to help me 
understand the result when the maxOccurs exists at both the choice and 
the nested elements, it would be greatly appreciated.

Scenario 1:

<xs:choice maxOccurs="1">
     <xs:element name="foo" type="xs:string" maxOccurs="unbounded"/>
     <xs:element name="bar" type="xs:string" maxOccurs="unbounded"/>
</xs:choice>

Is it correct to interpret this as: only one of either "foo" or "bar" 
allowed, with the implication that the "maxOccurs" attributes in the 
nested elements are essentially limited to 1 by the parent's 
"maxOccurrs" attribute?

Scenario 2:

<xs:choice maxOccurs="unbounded">
     <xs:element name="foo" type="xs:string" maxOccurs="unbounded"/>
     <xs:element name="bar" type="xs:string" maxOccurs="unbounded"/>
</xs:choice>

This would allow any number of both "foo" *and* "bar" elements, right? 
Does this contradict the purpose of the choice element to begin with, or 
am I just misunderstanding the function of the choice element?  In other 
words, how is scenario 2 different than just having the elements on 
their own, without the choice element?

Thanks,

Alex
Received on Friday, 31 October 2008 14:54:56 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
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-2007 All Rights Reserved.