Re: Order of elements in a complex-type

> Hi Seema,
> Simply replace the "xsd:sequence" with "xsd:all"
>
>> > How do I define it such that they may appear any number of
>times inside
>> Form  in any sequence ?
> ..insert  maxOccurs="unbounded"
> so it becomes:
>
>> > <xsd:complexType name="FormType" >
>> > <xsd:all>
>> > <xsd:element name="TextBox" type="TextBoxType" minOccurs="0"
>> maxOccurs="unbounded"/>
>> > <xsd:element name="TextArea" type="TextAreaType" minOccurs="0"
>> maxOccurs="unbounded"/>
>> > <xsd:element name="Header" type="HeaderType" minOccurs="0"
>> maxOccurs="unbounded"/>
>> > </xsd:all>
>> > </xsd:complexType>
>>

But as far as I know, the use of xs:all is quite restricted. One of the
restrictions is that you can only have maxOccurs="0" or maxOccurs="1" within
an xs:all, which eliminates the possibility to have an unrestricted number
of occurences of the three types within the FormType. Look at the problem
another way: The restriction in this case is a choice between three
different types of elements, and the choice can be done an unrestricted
number of times. Which gives us the schema below, which I think will do the
trick:

<xs:complexType name="FormType">
  <xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element name="TextBox" type="TextBoxType"/>
    <xs:element name="TextArea" type="TextAreaType"/>
    <xs:element name="Header" type="HeaderType"/>
  </xs:choice>
</xs:complexType>


Best regards

Erik Beijnoff
Systems development

erik.beijnoff@addsystems.com
erik@beijnoff.com

Received on Wednesday, 28 November 2001 09:34:32 UTC