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

Re: minOccurs

From: Eddie Robertsson <erobertsson@allette.com.au>
Date: Wed, 28 Aug 2002 09:44:34 +1000
Message-ID: <3D6C0EE2.2090807@allette.com.au>
To: Frédéric Jaouën <Frederic.Jaouen@accovia.com>
CC: xmlschema-dev@w3.org

Hi,

> I have define a group "groupA" which contains 3 optional elements.
>
> Is that correct to make a reference without specifying a minOccurs="0" 
> in my definition of "testMin" element even though all elements in 
> "groupA" are all optional ?
>
> Even though it is probably not very nice, I understand in the W3C that 
> it can be done and I should be able to validate it !
>
> RIGHT ???
>
I guess this depends on if your base type "S" and the "groupB" are valid 
but otherwise I don't see any problems with your schema. What errors are 
you getting?
One problem could be that your groupB defines the same elements as 
groupA which would create an ambigous content model since all your 
elements in groupA are optional.

Cheers,
/Eddie

> <xs:group name="*groupA*">
>   <xs:sequence>
>    <xs:element name="*A*" minOccurs="0">
>     <xs:simpleType>
>      <xs:restriction base="S">
>       <xs:maxLength value="64"/>
>      </xs:restriction>
>     </xs:simpleType>
>    </xs:element>
>    <xs:element name="*B*" minOccurs="0">
>     <xs:simpleType>
>      <xs:restriction base="S">
>       <xs:maxLength value="32"/>
>      </xs:restriction>
>     </xs:simpleType>
>    </xs:element>
>    <xs:element name="*C*" minOccurs="0">
>     <xs:simpleType>
>      <xs:restriction base="S">
>       <xs:maxLength value="32"/>
>      </xs:restriction>
>     </xs:simpleType>
>    </xs:element>
>   </xs:sequence>
>  </xs:group>
>
>  <xs:element name="*testMin*">
>   <xs:complexType>
>    <xs:sequence>
>     <xs:group ref="groupA"/>
>     <xs:group ref="groupB"/>
>    </xs:sequence>
>   </xs:complexType>
>  </xs:element>
>
> "groupB" maybe anything.
>
> Thanks !
>
> Frédéric Jaouën
>  
>
Received on Tuesday, 27 August 2002 19:45:06 GMT

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