XSD schema with choice

坚强是说给别人听的谎言 提交于 2019-12-02 07:05:30

This XSD,

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="r">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="studyYear" type="xs:string"/>
        <xs:choice>
          <xs:element name="orgID" type="xs:string"/>
          <xs:element name="userOID" type="xs:string"/>
          <xs:sequence>
            <xs:element name="orginID" type="xs:string"/>
            <xs:element name="providerId" type="xs:string"/>
          </xs:sequence>
        </xs:choice>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

will require studyYear to be followed by one of the following cases,

  • orgID, or
  • userOID, or
  • both originID and providerID

as requested.

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