Derived XML Schema Types
MapForce supports the mapping to/from derived types of a complex type. Derived types are complex types of an XML Schema that use the xsi:type attribute to identify the specific derived types.
The screenshot below shows the definition of a derived type called US-Address, in XMLSpy. The base type (or originating complex type) is AddressType. Two extra elements were added to create the derived type US-Address: Zip and State.
Sample derived type (XMLSpy schema view)
The following example shows you how to map data to or from derived XML schema types.
1.On the Insert menu, click XML Schema/File, and open the following XML Schema: <Documents>\Altova\MapForce2022\MapForceExamples\Tutorial\MFCompany.xsd.
2.When prompted to supply an instance file, click Skip, and then select Company as the root element.
3.Click the button next to the Address element. This button indicates that derived types exist for this element in the schema.
4.Select the check box next to the derived type you want to use (US-Address, in this case), and confirm with OK. A new element Address xsi:type="US-Address" has been added to the component.
You can now map data to or from the US-Address derived type.
Note that you can also include multiple derived types by selecting them in the Derived Types dialog box. In this case, each would have its own xsi:type element in the component.