Re: Order of elements in a complex-type (XSD)

Hi Dinesh,

> I want to make the order of elements to be immaterial in
> complex-type definition. But at the same time, I want to make the
> maximum occurance of one or two elements to be unbound. Is it
> possible to do that? When i have "xs:all", then i have make all the
> child element's maxOccurs = 1. But i want to make some elements to
> have "unbound" for maxoccurs. If i use "xs:choice", then all the
> child elements have maxOccurs="unbound".

You can't use <xs:all> to create a content model in which elements may
appear more than once.

So you have to use a content model like:

  (E4*, ((E3, E4*, t:Test1_Root) | (t:Test1_Root, E4*, E3)), E4*)

to get the elements to appear in any order with only one E3 and one
t:Test1_Root element.

Or you can use a looser content model and then use Schematron to add
the restrictions that E3 and t:Test1_Root have to appear only once.

Or you can have a tighter content model, in which the order of the
elements is fixed, and normalise your XML into that order prior to
validation.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Wednesday, 5 March 2003 11:19:41 UTC