XSD validation error: element does not exist in the redefined schema with target namespace

XSD validation error: element does not exist in the redefined schema with target namespace

目标: 在我的项目中,数据准备是由不同的团队在不同的层次上完成的。我们用于数据准备的格式是XML。 为了支持上述需求,我们准备了具有不同层(不同目标命名空间)的 XSD 层,每个 XSD 层将继承之前的 XSD 层并扩展它(感谢 XSD重新定义)。

问题:

infrastructureTypes.xsd:

<xs:schema xmlns:rail="http://www.railml.org/schemas/2016" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.railml.org/schemas/2016" elementFormDefault="qualified" version="2.3">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
<xs:include schemaLocation="railwayUnits.xsd"/>
<xs:include schemaLocation="railwayBaseTypes.xsd"/>
<xs:complexType name="tBasePlacedElement">
    <xs:complexContent>
        <xs:extension base="rail:tElementWithIDAndName">
            <xs:sequence>
                <xs:element name="geoCoord" type="rail:tGeoCoord" minOccurs="0" maxOccurs="1"/>
            </xs:sequence>
            <xs:attributeGroup ref="rail:aRelPosition"/>
            <xs:attributeGroup ref="rail:aAbsPosition"/>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>   

-----------------
----------------
---------------

基础设施-GenericADM.xsd:

<xs:schema xmlns="http://www.railml.org/schemas/2016" xmlns:GenericADM="http://www.transport.alstom.com/GenericADM/1" xmlns:rail="http://www.railml.org/schemas/2016" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.railml.org/schemas/2016" elementFormDefault="qualified" version="0.1" vc:minVersion="1.1">
<xs:import namespace="http://www.transport.alstom.com/GenericADM/1" schemaLocation="GenericADM.xsd"/>
<xs:redefine schemaLocation="railML.xsd">
    <xs:complexType name="tBasePlacedElement">
        <xs:complexContent>
            <xs:extension base="rail:tBasePlacedElement">
                <xs:attribute name="kPCorrectedTrolleyValue" type="rail:tLengthM" use="optional"/>
                <xs:attribute name="alternativeKP" type="rail:tLengthM" use="optional"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

当我使用 Altova XMLSpy 验证 XSDs 基础设施-GenericADM.xsd 时,出现以下错误:

rail:tBasePlacedElement is already declared. Error location: xs:schema/ xs:redefine/ xs:complexType. src-expredef: <xs:complexType> 'tBasePlacedElement' does not exist in the redefined schema with target namespace 'http://www.railml.org/schema/2016'

但是,使用 Oxygen XML Editor 和 Liquid Studio 等标准工具成功验证了相同的 XSD。

有人可以帮助了解问题所在吗。

提前致谢。

恐怕问题在于 xs:redefine 的规范有些模糊。 XSD 1.1 的作者认为解决互操作性问题是一项不可能完成的任务,这就是为什么 XSD 1.1 说

Note: The redefinition feature described in the remainder of this section is ·deprecated· and may be removed from future versions of this specification. Schema authors are encouraged to avoid its use in cases where interoperability or compatibility with later versions of this specification are important.

特别是,规范中确实没有很好地定义当模块 A 通过两条不同的路径引用模块 B 时应该发生什么,其中一条路径有 xs:redefine 步骤。