XSD any elements in any order
843834Aug 5 2004 — edited Aug 6 2004Hi,
I'm trying to figure out how to create an element that permits any number of certain elements to occur in any order, and I seem to be quite stuck. For example, given the special elements foo, bar, and foobar, I'd like to be able to create an XSD definition for the following:
<root>
<foo/>
<bar/>
<bar/>
<foo/>
<foobar/>
<bar/>
<foobar/>
<bar/>
<foo/>
</root>
Any ideas? I can do this:
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:choice minOccurs="0">
<xsd:element name="foo" type="FooType">
<xsd:element name="bar" type="BarType">
<xsd:element name="foobar" type="FooBarType">
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
But this seems not to work quite as expected. It lets me create:
<root><foo/></root>, <root><bar/></root>, or <root><foobar/></root>
But it doesn't permit having multiple occurrences of <foo> or even an occurrence of <foo> and one of <bar>.
Thanks