Christine McGavran wrote:
>>There are other ways
>>to define a complex type than using a sequence, for instance choice or
>>all. Thus if the order of elements doesn't matter to you then consider a
>>different type definition.
>
>
> Choice requires that only one of the elements occur. That doesn't work, as
> it would not allow me to have both a redWindow and a blueWindow as a child.
> All requires that no element may occur more than once, which means I could
> have redWindow and blueWindow in either order, but I could not have two
> redWindows. Both of those restrictions are unacceptable in my situation. Or
> am I missing something?
Yes, you are missing that you can give min and/or maxOccurs attributes
to schema elements, that you can nest a sequence in a choice etc. That
gives you a lot of ways to express how the content should look.
For instance to allow any number of blueWindow and redWindow child
elements in any order you could use a schema alike
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns

s="http://www.w3.org/2001/XMLSchema">
<xs:element name="windows">
<xs:complexType>
<xs:sequence>
<xs:element ref="window" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="window">
<xs:complexType>
<xs:sequence>
<xs:element name="children">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="redWindow" />
<xs:element name="blueWindow" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
As the type of the <children> element is a choice of redWindow or
blueWindow that can occur zero to unbounded times you can put in any
combination of <redWindow> and <blueWindow> child elements.
--
Martin Honnen
http://JavaScript.FAQTs.com/