首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何重新定义simpleType有联盟?

如何重新定义simpleType有联盟?
EN

Stack Overflow用户
提问于 2017-10-30 06:18:22
回答 1查看 122关注 0票数 0

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

sample1.xsd:

代码语言:javascript
复制
  <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>

sample2.xsd:

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

如何实现上述功能?

提前谢谢你。

EN

回答 1

Stack Overflow用户

发布于 2017-10-30 07:42:30

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

您已经将其标记为XSD1.1。在XSD1.1中,有一种新的机制xs:重写,它允许对基本模式中的组件进行任意更改。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47009093

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档