Re: <xsd:sequence> required?

This question is asked quite often.  The answer is equivalent for DTDs and 
schemas.  The general form in DTD is (A|B|C)*

adapting your case:

<xsd:complexType name="ModelType">
  <xsd:choice minOccurs="0 maxOccurs="unbounded">
    <xsd:element ref="cellml:units" />
    <xsd:element ref="cellml:component" />
    <xsd:element ref="cellml:group" />
    <xsd:element ref="cellml:connection"  />
    <xsd:element ref="rdf:RDF" />
  </xsd:choice>
  <xsd:attribute ref="cellml:name" use="required" />
  <xsd:attribute ref="cmeta:id" use="optional" />
</xsd:complexType>

I hope this meets your needs.

------------------------------------------------------------------
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------







Autumn Cuellar <a.cuellar@auckland.ac.nz>
Sent by: xmlschema-dev-request@w3.org
02/09/2002 09:21 PM
Please respond to a.cuellar

 
        To:     xmlschema-dev@w3.org
        cc: 
        Subject:        <xsd:sequence> required?


What I want to be able to say with the following piece of code is that
one can use the mentioned elements any number of times and in any order.

   <xsd:complexType name="ModelType">
     <xsd:element ref="cellml:units" minOccurs="0
maxOccurs="unbounded"/>
     <xsd:element ref="cellml:component" minOccurs="0"
       maxOccurs="unbounded" />
     <xsd:element ref="cellml:group" minOccurs="0"
       maxOccurs="unbounded"/>
     <xsd:element ref="cellml:connection" minOccurs="0"
       maxOccurs="unbounded" />
     <xsd:element ref="rdf:RDF" minOccurs="0" maxOccurs="unbounded" />
     <xsd:attribute ref="cellml:name" use="required" />
     <xsd:attribute ref="cmeta:id" use="optional" />
   </xsd:complexType>

Since the children elements can be in any order, the <xsd:sequence>
element is not useful.  Neither are the <xsd:choice> and <xsd:all>.  Is
it necessary that I use one of them in this case?  I do not quite
understand the concept of a model group and have not made it all the way
through Primer 1.  Thanks for your help!

Autumn A. Cuellar

Received on Monday, 11 February 2002 11:30:01 UTC