[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Order of elements in a complex-type

From: Erik Beijnoff <erik@addsystems.com>
Date: Wed, 28 Nov 2001 15:31:07 +0100
To: "'maddy pawar'" <madhuvanti@hotmail.com>
Cc: <2kseema@sun20.datamatics.com>, <xmlschema-dev@w3.org>
Message-ID: <914A89E9F99D2C4B8E14FB8CC083F9BC739B@addex001.addsystems.com>
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 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.