xsd: define an element that can be repeated an even number of times

不打扰是莪最后的温柔 提交于 2019-12-24 03:41:15

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!