Simple question

V

Volker Zink

I am writing my first schema and have 3 complex types which represent
"top level objects":

<complex type name="A1">
....
</complex type>

<complex type name="A2">
....
</complex type>

<complex type name="A3">
....
</complex type>


In the XML-Document i want that there may be any number of
corresponding elements in any order. I.e.

<A1></A1>
<A2></A2>
<A1></A1>
<A3></A3>
<A1></A1>
<A2></A2>

How do i model that in the schema?

I can't use the union, because these are complex types, and all is not
possible too because the number is unbounded. Is there a simple
solution to this simple problem?

Thanks

Volker
 
P

Peter Gerstbach

Volker said:
In the XML-Document i want that there may be any number of
corresponding elements in any order. I.e.

<A1></A1>
<A2></A2>
<A1></A1>
<A3></A3>
<A1></A1>
<A2></A2>

How do i model that in the schema?

Declare an unbounded choice element in your schema, e.g.:

<xs:element name="root">
<xs:complexType name="rootType">
<xs:choice maxOccurs="unbounded">
<xs:element name="A1"/>
<xs:element name="A2"/>
<xs:element name="A3"/>
</xs:choice>
</xs:complexType>
</xs:element>

Try it out! I hope this is what you where looking for.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top