Selecting a Substitution Type for Variables

When an XML Schema defines an XML element based on derived types, you must specify the derived type (or substitution type) expected during run time.

About this task

The XML Schema specification supports the ability to derive complex types by extension. For more general information about type substitution and about using type substitution in mapping panes, see Selecting a Substitution Type.

When an XML Schema defines an XML element based on derived types, you must specify the derived type (or substitution type) expected during run time. In Studio, you must specify the expected substitution type for the XML element of the variable using the Substitute Node With ... menu option as described in the following procedure.

To select a substitution type for a variable:

Procedure

  1. Upload an XML Schema that contains an XML element-based derived types into the project. For more information, see Uploading Files into a Project.
  2. Create a variable that contains an XML element based on derived types. The schema associated with the node displays in the "Schema of" pane of the Variables tab.

    For the example XML Schema provided in Selecting a Substitution Type, create a variable based on the <shape> element. The schema associated with the <shape> element is displayed in the "Schema of" pane of the Variables tab as shown in Figure 1:

    Figure 1. The schema associated with the shape element as displayed by the Schema of pane.

    Note that the child elements of the derived types are not listed in the "Schema of" pane.  In this example, the child element of circle which is named diameter is not listed, nor are the child elements of rectangle which are named width and length.

  3. In the "Schema Of" pane of the Variables tab, select the derived type expected during run time, by right-clicking the node and from the menu selecting the Substitute Node With ... option.

    The Substitute Node with a Derived Type dialog box is displayed. In the menu, the available derived types for the node as defined by the XML Schema are listed. For this example, the two derived types are available from the menu as shown in Figure 2:

    Figure 2. The figure shows the two derived types for the Node: circle and rectangle.
  4. Select one of the derived types. The selected derived type determines the expected type of XML instance document during run time.

    In this example, the circle derived type is selected, so the XML data expected for this variable during run time is of type circle.

    In addition to the child elements of the base type, the child elements of the derived type are displayed in the "Schema of" pane. In this example, the child element named diameter is displayed with the child element named color (inherited from the base type) in the "Schema of" pane of the Variables tab as shown in Figure 3:

    Figure 3. Variables tab

What to do next

When a derived type has been selected for a node of a variable using the Substitute Node With ... option, you can remove the association between the node of a variable and the derived type by right-clicking the node and selecting the Unsubstitute Node option from the menu. An Unsubstitute dialog box opens. Click Yes.



Feedback | Notices


Timestamp icon Last updated: Wednesday, 15 June 2016


http://pic.dhe.ibm.com/infocenter/wci/v7r0m0/topic/com.ibm.wci.doc/Selecting_a_Substitution_Type_for_Variables.html