0

我对在另一个 XSD 中重新定义一个简单类型的 XSD 有疑问。

样品1.xsd:

  <xs:simpleType name="tLineType">
    <xs:union>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="mainLine" />
          <xs:enumeration value="secondaryLine" />
          <xs:enumeration value="branchLine" />
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="tOtherEnumerationValue" />
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  <xs:simpleType name="tOtherEnumerationValue">
    <xs:restriction base="xs:string">
     <xs:pattern value="other:\w{2,}" />
    </xs:restriction>
  </xs:simpleType>

样品2.xsd:

我需要向 tLineType(ex:test_Track, Depot) 添加更多枚举值。

如何实现上述功能?

先感谢您。

4

1 回答 1

0

在 xs:redefine 中,您只能通过使其更具限制性来重新定义架构,而您正试图使其更加自由(通过添加以前不允许的允许值)。

您已将其标记为 XSD 1.1。在 XSD 1.1 中有一个新机制 xs:override,它允许对基本模式中的组件进行任意更改。

于 2017-10-30T07:42:30.927 回答