The default values for minOccurs
and maxOccurs
are 1. Thus:
<xsd:element minOccurs="1" name="asdf"/>
cardinality is [1-1] Note: if you specify only minOccurs attribute, it can't be greater than 1, because the default value for maxOccurs is 1.
<xsd:element minOccurs="5" maxOccurs="2" name="asdf"/>
invalid
<xsd:element maxOccurs="2" name="asdf"/>
cardinality is [1-2] Note: if you specify only maxOccurs attribute, it can't be smaller than 1, because the default value for minOccurs is 1.
<xsd:element minOccurs="0" maxOccurs="0"/>
is a valid combination which makes the element prohibited.
For more info see http://www.w3.org/TR/xmlschema-0/#OccurrenceConstraints
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…