RE: Need help with any and all

Jeni is correct, though I must say the wording in the spec can be
misinterpreted.  Section 3.8.6 (below) seems to imply that any ALL group is
OK as long as it is at the top of some model group definition, such as
"baseGroup" in the example.  However, once "baseGroup" is used in the
complex type, the ALL group is no longer in a model group definition -- it
is now in the content model of the complex type. And it is not valid since
it is not at the top of the complex type.
 
xan
 
[1] http://www.w3.org/TR/xmlschema-1/#cos-all-limited
<http://www.w3.org/TR/xmlschema-1/#cos-all-limited> 
 
Schema Component Constraint: All Group Limited 

When a model group has  <http://www.w3.org/TR/xmlschema-1/#compositor>
{compositor} all all of the following must be true: 
1 one of the following must be true: 
1.1 It appears as the model group of a model group definition. 
1.2 It appears in a particle with
<http://www.w3.org/TR/xmlschema-1/#p-min_occurs> {min occurs}=
<http://www.w3.org/TR/xmlschema-1/#p-max_occurs> {max occurs}=1, and that
particle must be part of a pair which constitutes the
<http://www.w3.org/TR/xmlschema-1/#content_type> {content type} of a complex
type definition. 
2 The  <http://www.w3.org/TR/xmlschema-1/#p-max_occurs> {max occurs} of all
the particles in the  <http://www.w3.org/TR/xmlschema-1/#particles>
{particles} of the group must be 0 or 1. 
 
-----Original Message-----
From: Brenda Bell [mailto:bbell@juicesoftware.com]
Subject: RE: Need help with any and all



Hmmmm... XMLSpy may have a bug that let's me do this.  Either way, I decided
to go with the extra element -- I believe it's a much cleaner approach for
this particular problem.

-----Original Message----- 
From: Jeni Tennison [ mailto:jeni@jenitennison.com
<mailto:jeni@jenitennison.com> ] 
Subject: Re: Need help with any and all 


Hi Brenda, 

> I actually found another option (perseverence is key :): 
> 
> <xs:group name="baseGroup"> 
>   <xs:all> 
>     <xs:element name="A" type="xs:string" minOccurs="1" 
>                                           maxOccurs="1"/> 
>     <xs:element name="B" type="xs:string" minOccurs="1" 
>                                           maxOccurs="1"/> 
>     <xs:element name="C" type="xs:string" minOccurs="1" 
>                                           maxOccurs="1"/> 
>   </xs:all> 
> </xs:group > 
> 
> <xs:complexType name="extendedType"> 
>   <xs:sequence> 
>     <xs:group ref="tns:baseGroup"/> 
>     <xs:any namespace="##other" minOccurs="0" 
>             maxOccurs="unbounded" processContents="skip"/> 
>   </xs:sequence> 
> </xs:complexType> 
        
Hmm... I don't think that this is legal; I think that the only place 
that you can refer to a model group definition whose model group is an 
all group is directly from a complex type definition. Testing with 
Xerces-C++ confirms this, though I can't put my finger on the place in 
the Rec where it's stated. 

Certainly, this ties in with the fact that you can't define an xs:all 
directly within a xs:sequence -- model group definitions are supposed 
to just give names to model groups so that you can reuse them, not 
allow you to do things that you can't do otherwise. 

Hopefully Henry or someone will be able to point to the relevant 
constraint in the Rec... 

Cheers, 

Jeni 

--- 
Jeni Tennison 
http://www.jenitennison.com/ <http://www.jenitennison.com/>  

Received on Monday, 25 February 2002 16:07:48 UTC