Re: xsd:sequence&In-Reply-To

[inline]
----- Original Message -----
From: "Liz Castro" <lcastro@cookwood.com>
To: <www-xml-schema-comments@w3.org>
Sent: Tuesday, August 08, 2000 10:14 PM
Subject: Re: xsd:sequence&In-Reply-To


> Thanks. Still, if it's implicit then is there ever a reason to use it
> explicitly?

[MJG]
Putting an explicit sequence in does no harm.

>
> And do the minOccurs and maxOccurs values in <xsd:sequence minOccurs='1'
> maxOccurs='1'> refer to each member of the group or to the group as a
> whole? (I'm guessing it refers to each member.)

[MJG]
Refers to the sequence as a whole. The following complexType

<complexType name='foo'>
  <element name='bar' minOccurs='1' maxOccurs='2' type='string' />
  <element name='baz' type='string' />
  <attribute name='quux' type='string' />
</complexType>

is equivalent to

<complexType name='foo'>
  <sequence minOccurs='1' maxOccurs='1' >
    <element name='bar' minOccurs='1' maxOccurs='2' type='string' />
    <element name='baz' type='string' />
  </sequence>
  <attribute name='quux' type='string' />
</complexType>


>
> And is the only way to _not_ structure the order of the elements in the
> instance by using xsd:all? (And is it also true that XSV has a bug with
> respect to xsd:all, since it allows more than one element in the group
> to appear in the instance despite the fact that the primer says the
> permissable values of minOccurs and maxOccurs are 0 and 1?)

[MJG]
You could use a repeating choice:

<complexType name='foo'>
  <choice minOccurs='0' maxOccurs='unbounded'>
    <element name='bar' minOccurs='1' maxOccurs='2' type='string' />
    <element name='baz' type='string' />
  </choice>
  <attribute name='quux' type='string' />
</complexType>

WRT <all> you are correct; particles in an <all> model group cannot have
minOccurs/maxOccurs of other than 0 or 1. I assume this is a bug in XSV but
I didn't write it and I've not checked it myself.

>
> And in that same paragraph (fifth para under 2.7), it states "All the
> elements in the group may appear once or not at all, and they may appear
> in any order."
[MJG]
I can't find the above phrase in the April 7th WD[1] ( and section 2.7 is
about Representation of Schemas on the World Wide Web ). Can you post an
URL?

Cheers

Martin Gudgin
DevelopMentor

Received on Tuesday, 8 August 2000 17:53:05 UTC