我發現自己。
我的例子之間的差異乍一看並不是很明顯,但如果這個例子稍微複雜一些,那就有道理了。
以下擴展澄清的差異:
<xsd:element name="XList">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="X" type="xsd:token"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="Y" type="xsd:token"
minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
導致
<XList>
<X>Only X</X>
<Y>Only Y</Y>
</XList>
而
<xsd:element name="XList">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="X" type="xsd:token"
minOccurs="1" maxOccurs="unbounded"/>
<xsd:element name="Y" type="xsd:token"
minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
導致
<XList>
<X>First X</X>
<X>Second X</X>
<X>Third X</X>
...
<Y>First Y</Y>
<Y>Second Y</Y>
...
</XList>
和
<xsd:element name="XList">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="unbounded" >
<xsd:element name="X" type="xsd:token"
minOccurs="2" maxOccurs="2"/>
<xsd:element name="Y" type="xsd:token"
minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
導致
<XList>
<X>First X</X>
<X>Second X</X>
<Y>First Y</Y>
<X>Third X</X>
<X>Fourth X</X>
<Y>Second Y</Y>
...
</XList>
和
<xsd:element name="XList">
<xsd:complexType>
<xsd:sequence minOccurs="1" maxOccurs="unbounded" >
<xsd:element name="X" type="xsd:token"
minOccurs="1" maxOccurs="unbounded"/>
<xsd:element name="Y" type="xsd:token"
minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
導致
<XList>
<X>First X</X>
<X>Second X</X>
<X>Third X</X>
...
<Y>First Y</Y>
<Y>Second Y</Y>
...
<X>Fourth X</X>
<X>Fifth X</X>
<X>Sixth X</X>
...
<Y>Third Y</Y>
<Y>Fourth Y</Y>
...
</XList>