问题
with xsd, is there a way in which we can define an element that is repeated an even number of times? with my information it is not possible with the attributes minOcurs and maxOccurs.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xs:element name="A">
<xs:complexType>
<xs:sequence>
<xs:element name="B" maxOccurs="?" minOccurs="?"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
回答1:
How about this:
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="B" maxOccurs="2" minOccurs="2"/>
</xs:sequence>
来源:https://stackoverflow.com/questions/27192211/xsd-define-an-element-that-can-be-repeated-an-even-number-of-times