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

Re: Original Choice (was RE: Choice)

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 13 Mar 2002 10:38:11 +0000
To: "Dare Obasanjo" <dareo@microsoft.com>
Cc: "Beyer,Nathan" <NBEYER@cerner.com>, "Naren Chawla" <naren_chawla@attbi.com>, "Schema Dev XML (E-mail)" <xmlschema-dev@w3.org>
Message-ID: <f5b1yeog3cc.fsf@cogsci.ed.ac.uk>
"Dare Obasanjo" <dareo@microsoft.com> writes:

> > -----Original Message-----
> > From: Beyer,Nathan [mailto:NBEYER@cerner.com] 
> > Sent: Tuesday, March 12, 2002 3:59 PM
> > To: Dare Obasanjo; Naren Chawla; Schema Dev XML (E-mail)
> > Subject: RE: Original Choice (was RE: Choice)
> > 
> > 
> > Well, if I'm reading the normative XML Schema correctly 
> > (http://www.w3.org/2001/XMLSchema.xsd), then I'm even more confused.
> > According to the that schema, the element "choice" is of type 
> > "xs:explicitGroup." "xs:explicitGroup" is an extension of 
> > "xs:group," which allows the minOccurs and maxOccurs attributes.
> > But, according to the schema, the element "group" is of type 
> > "xs:namedGroup." "xs:namedGroup" has a choice between "all," 
> > "choice," and "sequence." The "choice" in here is is of type 
> > "xs:simpleExplicitGroup" which prohibits the user of the 
> > minOccurs and maxOccurs attributes.
> > 
> > Am I reading that correctly?
> 
> 
> The third to sixth lines of the document you quote from are
> 
> 	<!--  Note this schema is NOT the normative structures schema.
> --> 
> 	<!--  The prose copy in the structures REC is the normative
> --> 
>       <!--  version (which shouldn't differ from this one except for -->
> 
>       <!--  this comment and entity expansions, but just in case     -->

But in all relevant regards the two documents are identical, this is a
red herring.

> > To me the ambigous piece of using a choice how to interpret 
> > the occurs attributes on the choice compositor in conjunction 
> > with the occurs attributes on the particles within the 
> > choice, especially when they are in conflict.
> > 
> > For example, how do I interpret this:
> > 			<xs:choice minOccurs="1" maxOccurs="1">
> > 				<xs:element name="choice1" minOccurs="0"
> > maxOccurs="1"/>
> > 				<xs:element name="choice2" minOccurs="0"
> > maxOccurs="1"/>
> > 			</xs:choice>
> > -or this one:
> > 			<xs:choice minOccurs="0" maxOccurs="unbounded">
> > 				<xs:element name="choice1" minOccurs="1"
> > maxOccurs="1"/>
> > 				<xs:element name="choice2" minOccurs="1"
> > maxOccurs="1"/>
> > 			</xs:choice>

There's no conflict here.

 The first says

  choose (once) between an optional c1 or an optional c2

 So you're allowed nothing, or c1, or c2

 The second says

  choose (any number of times) between a required c1 or a required c2

 So you're allowed nothing, or c1, or c2, or c1c1, or c1c2, or c2c1,
   or c2c2, or . . .

Perhaps converting to DTD notation would help?

 The first is (c1?|c2?)
 The second is (c1|c2)*
 Your earlier example was (c1*|c2*)

Hope this helps.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Wednesday, 13 March 2002 05:38:23 GMT

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