RE: [xml-dev] minOccurs maxOccurs doesnt seem to be working correctly in my schema

From
Marielou <>
To
Michael Kay <>, 'Paul Spencer' <>,
Date
2006-06-14T10:14:53Z
ID
<>
Thread
RE: [xml-dev] minOccurs maxOccurs doesnt seem to be working correctly in my schema
So is the following expected to work out:
in element A, I have <all> elements occuring 0 or 1
times max:

<xs:element name="A">
<xs:complexType>
<xs:all>
<xs:element ref="progid" minOccurs="1" maxOccurs="1"/>
<xs:element ref="start" minOccurs="1" maxOccurs="1"/>
<xs:element ref="end" minOccurs="1" maxOccurs="1"/>
<xs:element ref="pil" minOccurs="0" maxOccurs="1"/>
...
<xs:element ref="B" minOccurs="0" maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>

and the elements which need to be able to occur more
than once are referenced in A, but defined outside of
element A. e.g. element ref B has occurences defined
in element B where e.g. in a sequence in B the element
can have maxOccurs "unbounded":

<xs:element name="B">
 <xs:complexType>
  <xs:sequence>
   <xs:element ref="audio" minOccurs="0"
maxOccurs="unbounded"/>
  </xs:sequence>
 </xs:complexType>
</xs:element>

the element referenced in B is then also declared
separately e.g.

<xs:element name="audio">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="8"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

Thanks!

Marie Louise

--- Michael Kay <> wrote:

> > does this disallow using <all> with {min occurs}=0
> or 1, {max 
> > occurs}=1, and using element ref to reference
> another  
> > element which has a <sequence> which can occur
> more than 1x? 
> 
> No. If element B is a child of element A, then the
> content model for B is
> entirely independent of the content model for A.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> 


Send instant messages to your online friends http://uk.messenger.yahoo.com