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

RE: <xsd:sequence> required?

From: Mark Feblowitz <mfeblowitz@frictionless.com>
Date: Tue, 12 Feb 2002 11:03:17 -0500
Message-ID: <4DBDB4044ABED31183C000508BA0E97F040AB883@fcpostal.frictionless.com>
To: "'Bob Schloss'" <rschloss@us.ibm.com>, xmlschema-dev@w3.org
Cc: "Andrew Warren (E-mail)" <awarren@openapplications.org>, "Kurt A Kanaskie (Kurt) (E-mail)" <kkanaskie@lucent.com>, Mark Feblowitz <mfeblowitz@frictionless.com>, "Michael Rowell (E-mail)" <mrowell@openapplications.org>
Yes, this would achieve the desired effect. But at a high cost. 

First, it would require global elements for each thing in the substitution
group, creating global bindings for each of those things that could
otherwise be bound locally.

Second, it would preclude involving these elements in any other substitution
group for any other (otherwise valid) modeling purpose.

I, for one, will opt for fixed ordering, rather than using the scarce and
otherwise valuable resource of a substitution group for the purpose of
flexible ordering.

Thanks for the suggestion, though.

Mark

----------------------------------------------------------------------------
----
 
Mark Feblowitz                                   [t] 617.715.7231
Frictionless Commerce Incorporated     [f] 617.495.0188 
XML Architect                                     [e]
mfeblowitz@frictionless.com
400 Technology Square, 9th Floor 
Cambridge, MA 02139 
www.frictionless.com  
 

 -----Original Message-----
From: 	Bob Schloss [mailto:rschloss@us.ibm.com] 
Sent:	Tuesday, February 12, 2002 10:43 AM
To:	Mark Feblowitz; xmlschema-dev@w3.org
Subject:	RE: <xsd:sequence> required?


To do what you want, you should have

 <xsd:complexType name="ModelType">
   <xsd:sequence>
    <xsd:element ref="head" minOccurs="0"
                 maxOccurs="unbounded"/>
   </xsd:sequence>
 </xsd:complexType>

and extending this would be done by saying

 <xsd:element name="yourNewElement" substitutionGroup="head"/>

[Note, head should only be used in this one place!]

Were you to do
 <xsd:complexType name="ModelType">
   <xsd:choice>
    <xsd:element ref="child1" minOccurs="0"
                 maxOccurs="unbounded"/>
   </xsd:choice>
 </xsd:complexType>
followed by derivation (via normal extension or <redefine> extension)
  <xsd:complexType ... >
    <xsd:extension base="ModelType">
      <xsd:choice>
         <xsd:element ref="newChild" minOccurs="0"
                      maxOccurs="unbounded"/>
      </xsd:choice>
    </xsd:extension>
   </xsd:complexType>

the content model would be a sequence of a first choice
(containing child1 0..n times) and then a second choice
(containing newChild 0..n times).

      I do not recall exactly where the spec describes
this.




Mark Feblowitz <mfeblowitz@frictionless.com>@w3.org on 02/12/2002 09:39:54
AM

Sent by:    xmlschema-dev-request@w3.org


To:    "'Eddie Robertsson'" <erobertsson@allette.com.au>,
       xmlschema-dev@w3.org
cc:    xmlschema-dev@w3.org
Subject:    RE: <xsd:sequence> required?



I've asked this before, but don't recall seeing an answer:

Is the design pattern of an unbounded choice extensible?

If I extend a type that contains an unbounded choice element and specify
that the extended type also contains an unbounded choice element, would the
behavior be

1) a full combination of the two sets of elements, appearing in any order,
or

2) two separate choice subsets with elements in each subset appearing in
any
order


Extensibility of this pattern could be an important design criterion.

Thanks,

Mark


----------------------------------------------------------------------------

----

Mark Feblowitz                                   [t] 617.715.7231
Frictionless Commerce Incorporated     [f] 617.495.0188
XML Architect                                     [e]
mfeblowitz@frictionless.com
400 Technology Square, 9th Floor
Cambridge, MA 02139
www.frictionless.com


 -----Original Message-----
From:       Eddie Robertsson [mailto:erobertsson@allette.com.au]
Sent: Monday, February 11, 2002 7:01 AM
To:   xmlschema-dev@w3.org
Cc:   xmlschema-dev@w3.org
Subject:    Re: <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?

Yes, you always need to have one of sequence, all or choice specified.
Since
you want all elements to appear any number of times and in any order you
can
add minOccurs="0" and maxOccurs="unbounded" to the choice element itself.
So, you would have:

   <xsd:complexType name="ModelType">
    <xsd:choice minOccurs="0" maxOccurs="unbounded">
     <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:choice>
    <xsd:attribute ref="cellml:name" use="required" />
    <xsd:attribute ref="cmeta:id" use="optional" />
   </xsd:complexType>

Cheers,
/Eddie
Received on Tuesday, 12 February 2002 11:03:49 GMT

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