XML Schema specifies “occurrence indicators” (maxOccurrence, minOccurrence). Is there a “best practice” in which elements (xsd:element, xsd:sequence or xsd:all) these indicators should be used?
Example:
either
<xsd:element name="XList">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="X" type="xsd:token" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
or
<xsd:element name="XList">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:element name="X" type="xsd:token" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
I want to arrive at:
<XList>
<X>First</X>
<X>Second</X>
<X>Third</X>
<X>Fourth</X>
<X>Fifth</X>
...
</XList>
I found out myself.
The difference between my examples is not very obvious on the first glance, but if the example had been a little more complex it would have made sense.
The following extension clarifies the differences:
leads to
whereas
leads to
and
leads to
and
leads to