I don\'t understand how I should define my complex type.
Today I have this:
You can use <xsd:choice minOccurs="0" maxOccurs="unbounded">
instead of your xsd:sequence
in order to emulate non-ordered element validation. This circumvents the limitations of xsd:all
.
In XSD 1.0, your alternatives are (if you want to keep things simple) as you have identified them:
If the ordering does not carry meaning (so the sequence document-id, filename, author and the sequence author, document-id, filename carry the same information), then there is no loss of expressive power in fixing the sequence. Or you can use an unbounded choice, as suggested by predi, and place part of the validation logic (checking cardinality) in another layer of the application. The vocabulary designers I think most highly of generally recommend a sequence in this situation.
Two other approaches are worth mentioning: