Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XSD any elements in any order

843834Aug 5 2004 — edited Aug 6 2004
Hi,

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 3 2004
Added on Aug 5 2004
1 comment
270 views