W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2004

Intepretation of choice compositor and occurence into xml schema

From: Hess Yvan <yvan.hess@imtf.ch>
Date: Wed, 4 Feb 2004 17:17:36 +0100
Message-ID: <DF7EC83D7AFBD411965B0008C7596EC5E0D420@imtfexchange.imtf.ch>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

It is not clear for me how to interpet attribute elements
minOccurs/maxOccurs into <choice> element having sub-elements that also have
minOccurs/maxOccurs attributes as for example 

Schema 1:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:element name="document">
      <xs:complexType>
         <xs:choice minOccurs="0" maxOccurs="2">
            <xs:element name="A" minOccurs="1" maxOccurs="1"/>
            <xs:element name="B" minOccurs="1" maxOccurs="1" />
            <xs:element name="C" minOccurs="1" maxOccurs="1"/>
         </xs:choice>
      </xs:complexType>
   </xs:element>
</xs:schema>

Schema 2:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:element name="document">
      <xs:complexType>
         <xs:choice minOccurs="1" maxOccurs="unbounded">
            <xs:element name="A" minOccurs="0" maxOccurs="1"/>
            <xs:element name="B" minOccurs="0" maxOccurs="1" />
            <xs:element name="C" minOccurs="0" maxOccurs="1"/>
         </xs:choice>
      </xs:complexType>
   </xs:element>
</xs:schema>

Schema 3:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:element name="document">
      <xs:complexType>
         <xs:choice minOccurs="1" maxOccurs="unbounded">
            <xs:element name="A" minOccurs="1" maxOccurs="1"/>
            <xs:element name="B" minOccurs="0" maxOccurs="3" />
            <xs:element name="C" minOccurs="0" maxOccurs="1"/>
         </xs:choice>
      </xs:complexType>
   </xs:element>
</xs:schema>


I tried to find more information about this subject on the web, but I didn't
succeed.

Can somebody give me more information about how to interpret schema 1,
schema 2 and schema 3 ?

Thanks for your help.

Yvan
Received on Wednesday, 4 February 2004 11:22:44 GMT

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