我无法弄清楚这段代码有什么问题:
<xs:choice>
<xs:element name="tiles" type="tiles" minOccurs="1" maxOccurs="1"/>
<xs:element name="tiles" type="tiles-with-key" minOccurs="2" maxOccurs="unbounded"/>
</xs:choice>
key
只要有多个tiles
元素,我就需要一个属性:
<!-- one element, no need for the "key" attribute -->
<tiles>
...
</tiles>
<!-- two elements, we need the "key" to differentiate them -->
<tiles key="1">
...
</tiles>
<tiles key="2">
...
</tiles>
我究竟做错了什么?