Skip to content

xsd2ttcn: type substitution is not always performed across multiple schemas

Type substitution is not performed if the head type and the usage element are in one schema, and all types restricting/extending the head type are in other schemas.

Example:

a.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.somewhere.com/a" targetNamespace="http://www.somewhere.com/a" elementFormDefault="qualified">
  <xs:complexType name="BaseType" abstract="true">
    <xs:sequence>
      <xs:element name="baseField" type="xs:integer"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UsageType">
    <xs:sequence>
      <xs:element name="usage" type="BaseType"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

b.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.somewhere.com/b" xmlns:a="http://www.somewhere.com/a" targetNamespace="http://www.somewhere.com/b" elementFormDefault="qualified">
  <xs:import namespace="http://www.somewhere.com/a" schemaLocation="a.xsd"/>
  <xs:complexType name="DerivedType">
    <xs:complexContent>
      <xs:extension base="a:BaseType">
        <xs:sequence>
          <xs:element name="extraField" type="xs:string" minOccurs="0"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>

/cc @aknappqwt @mmagyari