Trading Networks 10.3 | Administering and Monitoring B2B Transactions | Service Development Help | Working with Document Types | Creating an IS Document Type | Derived Types and IS Document Types
 
Derived Types and IS Document Types
 
*doctype Fields in IS Document Types and Document Fields
*doctype Fields in IS Document Types
*doctype Fields in Document Fields
In an XML schema definition, new complex types can be derived from an existing complex type. The new derived complex types (or simply derived types) are created by either extending or restricting the base complex type. When extended, the derived type contains additional elements or attributes that are not defined for the base type. When restricted, the derived type contains a subset of the original elements or attributes defined for the base type.
When you generate an IS document type from an XML schema definition that contains derived types and you select the Generate document types for complex types option, Integration Server creates an IS document type for the base type and one for each derived type. IS document types that represent derived types are referred to as derived document types.
For example, an XML schema might contain a complex type that defines the structure of an address and a derived type that extends the Address complex type to define an address that is specific to the United States:
<xsd:element name="purchaseOrder">
<xsd:sequence>
<xsd:element name="id" type="xsd:string"/>
<xsd:element name="invoiceAddress" type="order:Address">
</xsd:sequence>
</xsd:element>
<xsd:complexType name="Address">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="USAddress">
<xsd:complexContent>
<xsd:extension base="order:Address">
<xsd:equence>
<xsd:element name="state"/>
<xsd:element name="zip"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
If you generate an IS document type from this XML schema definition and you select the Generate document types for complex types option, Integration Server creates an IS document type for the base Address complex type and another for the derived USAddress complex type.
When data conforms to the derived version rather than the base, an XML document or IData object should indicate the specific derived version that is in use:
*In an XML document, the xsi:type attribute is included to specify the derived type being used for a complex type. For example, the following XML line indicates that the invoice address will use the alternate format defined by the USAddress complex type:
<invoiceAddress xsi:type="order:USAddress">
*In a document (IData object), Integration Server uses the *doctype field, which contains the name of the derived document type that represents the structure of a Document field.