本文介绍了xsd:定义一个可以重复偶数次的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用xsd,有没有办法定义一个重复偶数次的元素?根据我的信息,属性 minOcurs 和 maxOccurs 是不可能的.
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>
推荐答案
这个怎么样:
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="B" maxOccurs="2" minOccurs="2"/>
</xs:sequence>
这篇关于xsd:定义一个可以重复偶数次的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!