Aim: In my project, the data preparation is done in different levels by different teams. The format we use for data preparation is XML. To support the above needs, we have prepared the XSDs with different layers(different target namespaces) and each XSD layer will inherit the previous XSD layers and extend it(Thanks to the XSD redefinition).
Issue:
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>
-----------------
----------------
---------------
infrastructure-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>
When i validate the XSDs infrastructure-GenericADM.xsd using Altova XMLSpy, it is giving the following error:
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'
However, the same XSDs are validated successfully using the standard tools like Oxygen XML Editor and Liquid Studio.
Can someone help to understand what is the issue.
Thank you in advance.
