且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

XSD:如何重新定义 simpleType 的数据类型,例如.从 xs:string 到 xs:integer

更新时间:2023-09-11 21:44:28

据我所知这是不可能的.

As far as I can tell this is not possible.

我可以在 XMLSpy 中进行验证的唯一重新定义是:

The only redefine I could make validate in XMLSpy was:

<xs:redefine schemaLocation="fields-base.xsd"> 
        <xs:simpleType name="LastUpdateTime_t"> 
          <xs:restriction base="LastUpdateTime_t" /> 
        </xs:simpleType> 
</xs:redefine> 

也就是说,新的限制必须基于基础限制.

That is, the new restriction must be based on the base restriction.

这可能是 XMLSpy 错了.

Could be that XMLSpy is wrong about this.

这个来自 W3C XML 的有点神秘的引用架构定义:

在 [children] 中,每个simpleType 必须有一个在它的 [孩子] 和每个complexType 必须有限制或在其间延伸Grand-[children] 的·实际价值·其基础 [属性] 必须是与其自身的实际价值相同name 属性加上目标命名空间;

Within the [children], each simpleType must have a among its [children] and each complexType must have a restriction or extension among its grand-[children] the ·actual value· of whose base [attribute] must be the same as the ·actual value· of its own name attribute plus target namespace;

可能正在谈论这个(这是 XMLSpy 链接到此错误的规范的一部分).

might be talking about this (it is that part of the spec the XMLSpy links to for this error).

我能找到的重新定义简单类型的唯一很好的例子是 这里.在本例中,重定义仅用于枚举.

The only really good example of redefining simple types I could find was here. In this example, the redefinition is only for enumerations.