Middle way between XSD all and XSD sequence

Could you just turn your “nationality” thingie into its own complexType and then use that new complex type inside your xs:all?

<xs:complexType name="NationalityType">
  <xs:sequence>   
    <xs:element name="nationality" minOccurs="1" maxOccurs="unbounded" />
  </xs:sequence>
</xs:complexType>

<xs:all>
  <xs:element name="name" blabla />
  <xs:element name="email" blabla />
  <xs:element name="nationalities" type="NationalityType" />
</xs:all>

I don’t have anything at hand to test this, so this is really just off the top of my head….. give it a try!

EDIT: tested it by now – it works, the only minor price to pay is that your XML will have to look something like this:

<....>
  <email>......</email>
  <nationalities>
    <nationality>ABC</nationality>
    <nationality>CDE</nationality>
  </nationalities>
  <name>.....</name>
</.....>

So you get an extra node that will contain the arbitrary long list of <nationality> items.

Marc

Leave a Comment