XSD - 只有少数属性是强制性的

问题描述 投票:0回答:1
xsd attributes
1个回答
0
投票

XSD 1.1 断言:

<xs:element name="Custom">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" name="Entry">
              <xs:complexType>
                <xs:attribute name="Key" type="xs:string" use="required" />
                <xs:attribute name="Type" type="xs:string" use="required" />
                <xs:attribute name="Value" type="xs:string" use="required" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:assert test="some $entry in Entry satisfies $entry/@Key = 'Abstract' and $entry/@Value = 'Emsur'"/>
          <xs:assert test="some $entry in Entry satisfies $entry/@Key = 'TempID' and $entry/@Value = '12345'"/>
        </xs:complexType>
</xs:element>
© www.soinside.com 2019 - 2024. All rights reserved.