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

Re: Intepretation of choice compositor and occurence into xml schema

From: Bob Schloss <rschloss@us.ibm.com>
Date: Wed, 4 Feb 2004 11:53:19 -0500
To: Hess Yvan <yvan.hess@imtf.ch>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-ID: <OFB4826354.69B44628-ON85256E30.005B16D4-85256E30.005CC5B4@us.ibm.com>





Hess,

The first content model permits
<document/>

<document><A>..</A></document>
<document><B>..</B></document>
<document><C>..</C></docuemnt>


<document><A>..</A><A>..</A></document>
<document><A>..</A><B>..</B></document>
<document><A>..</A><C>..</C></document>
<document><B>..</B><B>..</B></document>
<document><B>..</B><C>..</C></document>
<document><B>..</B><A>..</A></document>
<document><C>..</C><A>..</A></document>
<document><C>..</C><B>..</B></document>
<document><C>..</C><C>..</C></document>

corresponding to occurs of 0, 1 and 2 for the choice particle.


The middle content model permits

<document/> where every inner occurs is 0

<document><A>..</A></document>
<document><B>..</B></document>
<document><C>..</C><document>
where the outer occurs is 1 and the inner occurs is 1

<document>any sequence of multiple A,B,C tags whatsoever</document>
where the outer occurs is > 1 and the inner occurs is sometimes 0 and
sometimes 1




Your last content model permits

<document/>
where outer occurs was 1 and choice went to element B or element C with
occurs of 0

<document><A>,,</A></document>
<document><B>..</B></document>
<document><B>..</B><B>..</B></document>
<document><B>..</B><B>..</B><B>..</B></document>
<document><C>..</C></document>
where outer occurs was 1

any valid concatentation of the content patterns shown above is permitted,
where occurs > 1



Good luck,
Bob

XML/XSL Transformational Systems - Extensible Technologies
IBM Thomas J Watson Research Center
Yorktown Heights, New York, USA






                                                                           
             Hess Yvan                                                     
             <yvan.hess@imtf.c                                             
             h>                                                         To 
             Sent by:                  "'xmlschema-dev@w3.org'"            
             xmlschema-dev-req         <xmlschema-dev@w3.org>              
             uest@w3.org                                                cc 
                                                                           
                                                                   Subject 
             02/04/2004 11:17          Intepretation of choice compositor  
             AM                        and occurence into xml schema       
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





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:53:59 GMT

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