W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2001

Re: Order of elements in a complex-type

From: Rahul Srivastava <Rahul.Srivastava@Sun.COM>
Date: Wed, 28 Nov 2001 18:06:34 +0000 (Asia/Calcutta)
Message-Id: <200111281239.fASCdvh15297@blr-root.India.Sun.COM>
To: xmlschema-dev@w3.org
> From: "Seema Kumar" <2kseema@sun20.datamatics.com>
> 
> Hello all,
> 
> I am relatively new to XML schema and am facing a few problems while
> defnining complex types.
> 
> Is there any mechanism where the order of elements in a complex-type may be
> made immaterial in a complex-type defnition ?

Yes, you can use <all> to specify the elements to appear in any order.
Thus, in your example if you change <xsd:sequence> to <xsd:all>, you can have 
any order in your instance file.

Cheers,
Rahul.

> 
> For eg  in the following defnition :
> <xsd:complexType name="FormType" >
> <xsd:sequence>
> <xsd:element name="TextBox" type="TextBoxType" minOccurs="0"/>
> <xsd:element name="TextArea" type="TextAreaType" minOccurs="0"/>
> <xsd:element name="Header" type="HeaderType" minOccurs="0"/>
> </xsd:sequence>
> </xsd:complexType>
> 
> the schema parser expects the elements TextBox, TextArea and Header to
> appear in the same sequence.
> How do I define it such that they may appear any number of times inside Form
> in any sequence ?
> Thanks in advance.
> 
> Bye
> Seema
> 
> 
Received on Wednesday, 28 November 2001 08:36:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:35 GMT