I need to write an XSD schema. In this schema, some elements are known and mandatory, others are unknown and optional:
<father>
<childMandatory1 />
<childMandatory2 />
<childOptionnal1 />
</father>
or: (changing the mandatory children order)
<father>
<childMandatory2 />
<childMandatory1 />
</father>
I know the mandatory children (but not their order). But I don't know if there will be any optional child(ren) (and if so, their names).
I tried with "xs:all", but "xs:all" does not allow "any" :
<xs:element name="father">
<xs:complexType>
<xs:all>
<xs:element ref="childMandatory1" />
<xs:element ref="childMandatory2" />
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
<!-- error here ! -->
</xs:all>
</xs:complexType>
</xs:element>
I tried with sequence, but I should know the order of elements. (and I don't)
I tried with choice, but choice cannot work with any and some mandatory elements. (and I want to be sure that the mandatory element are present)