In XSD, you can make some element optional or mandatory. This can be controlled by explicitly defining the
multiplicity, which can be understood as a
constraint over the number of occurrences, using the attributes
minOccurs
and
maxOccurs
. Here the usage is explained on a simple sample:
http://stackoverflow.com/questions/9243772/how-to-make-an-element-in-xml-schema-optional[
^].
See also:
http://en.wikipedia.org/wiki/Multiplicity_%28software%29[
^].
[EDIT]
Another thing to do is to declare polymorphic type
Metadata
(with polymorphic composition sequence).
See, for example:
http://ojitha.blogspot.com/2012/01/learn-xml-schema-by-example-2.html[
^].
Alternatively, don't use sequence. Use a set of fixed components of different type with different multiplicity on each.
In other words, your schema is not adequate to the requirements on upper level. You need to redesign it.
—SA