xsi:type support for abstract and concrete data types

IBM Sterling Transformation Extender supports the xsi:type attribute.

You can use the xsi:type attribute for substitution groups, elements that are defined as either abstract or concrete, or elements that are defined by either abstract or concrete types. The support for xsi:type creates choices for these types that can receive the xsi:type attribute at run time.

For example:
  • When a type is defined as abstract, the corresponding imported type tree type is created as a choice of all the types that extend the abstract type.
  • When a type is defined as concrete, the corresponding imported type tree type is created as a choice of the concrete type and all the types that extend the concrete type.
In the following Schema fragment, the type Address is defined as abstract and the types US-address and UK-address are simple extensions of the abstract type. An address element in an instance document must contain an xsi:type attribute to specify a concrete type. The validation library uses the xsi:type attribute to determine the real type that is specified and validate the type correctly.

<!-- abstract type -->
<xs:complexType name="Address" abstract="true">
  <xs:sequence>
   <xs:element name="street" type="xs:string" /> 
   <xs:element name="city" type="xs:string" /> 
  </xs:sequence>
 </xs:complexType>  
<!-- concrete types --> 
<xs:complexType name="US-address">
  <xs:complexContent>
    <xs:extension base="Address">
      <xs:sequence>
        <xs:element name="zip" type="xs:integer" /> 
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>
<xs:complexType name="UK-address">
  <xs:complexContent>
    <xs:extension base="Address">
      <xs:sequence>
        <xs:element name="postalCode" type="xs:string" /> 
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>
<!-- abstract type -->
<xs:element name="address" type="Address">