Page 1 of 1

Another question about indicators

Posted: Fri Nov 12, 2004 2:35 pm
by Guest
Hi,

I wonder how I can set the indicator, that certain elements have to be set before others and only once, while others can occur several times!

This is the example and the elements duration and name have to be set before slide. It doesn't matter if they are set at all or in which order. Slide should occur at least once, but could more than that.
Could be like name | duration | slide | slide...
or duration | slide | slide...

<xs:element name="presentation">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="duration" minOccurs="0" maxOccurs="1"/>
<xs:element ref="name" minOccurs="0" maxOccurs="1" />
<xs:element ref="slide" minOccurs="1" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
</xs:element>

Is it possible to nest indicators like:

<xs:choice>
<xs:all>
<xs:element></xs:element>
<xs:element></xs:element>
<xs:element></xs:element>
</xs:all>
<xs:element></xs:element>
</xs:choice>

Thanx in advance Rainer...

Posted: Fri Nov 12, 2004 7:23 pm
by george
Hi,

If you can enforce name before duration then you can use something like

Code: Select all


<xs:sequence>
<xs:element ref="name" minOccurs="0"/>
<xs:element ref="duration" minOccurs="0"/>
<xs:element ref="slide" maxOccurs="unbounded"/>
</xs:sequence>
If you want to have also duration, name, slide then you can use something like below (it is a little more complicated because you need to avoid ambiguity):

Code: Select all


<xs:choice>
<xs:sequence>
<xs:element ref="name"/>
<xs:element ref="duration" minOccurs="0"/>
<xs:element ref="slide" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="duration"/>
<xs:element ref="name" minOccurs="0"/>
<xs:element ref="slide" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element ref="slide" maxOccurs="unbounded"/>
</xs:sequence>
</xs:choice>
Best Regards,
George