tags:

views:

17

answers:

2

Say I have an element, call it <A>. <A> can have children types of <B> and <C>. Now - here's the twist. Any number of <B> and <C> children can live in <A>, in any order.

For example:

<A>
  <C>
  <C>
  <B>
  <C>
  <B>
  <B>
  <C>
  ...
</A>

Is there a schema rule that fits this? Seems like "all" would work, if I could put maxOccurs="unbounded", but I guess that's not legal.

+1  A: 

Answering my own question -- looks like trang (http://www.thaiopensource.com/relaxng/trang.html) gave me the anwer:

<xs:element name="A">
  <xs:complexType>
    <xs:choice maxOccurs="unbounded">
      <xs:element ref="B"/>
      <xs:element ref="C"/>
    </xs:choice>
  </xs:complexType>
</xs:element>

Very cool!

desau