Creating a Data Flow Using a Target Based on a Predefined XML Schema

When creating an XML file, the format of the XML file is usually pre-defined by an xml schema or .xsd file. DataMigrator lets you create a synonym from a schema definition and then map to that target in the same manner as a relational database table.

Single-segment and multiple-segment schemas are supported, but multiple-segment schemas must be single-path.

This technique is divided into two parts. In the first part, we create a synonym for the XML file; in the second, we use that synonym as the target of a flow.

In the example shown in the following image, the data source is DMORD. The target is described by the schema dmxord.xsd.

Refer to the sample data flow DMORDXML, for the complete example.

This is the structure of the schema (dmxord.xsd), which will be used to create a synonym to demonstrate this technique.

Schema Structure

Note: To write to an XML target, the XML adapter must be configured on your server.


Top of page

Example: Creating a Synonym for an XML File

An xsd file contains a description of an XML file. This example shows how to create a synonym for the dmxord.xsd, which is installed with your server.

  1. In the DMC, right-click the baseapp application directory in the navigation pane and choose New, and then Synonym.

    The Create Synonym dialog box opens, as shown in following image.

    Create Synonym Dialog Box

  2. Select XML and click Configure.

    A dialog box confirming that you have added the synonym successfully appears.

  3. Click Create Synonym.

    The XML Definition Document dialog box opens.

  4. Enter the location of the xsd file in the Collection of XML definitions field, as shown in following image. The sample xsd file distributed with the server is in ibisamp, so enter C:\ibi\apps\ibisamp for a Windows server.

    XML Definition Document

  5. Click Next.

    The Create Synonym for XML dialog box opens.

  6. Select the check box for dmxord and enter baseapp/dmxord.xml in the Dataset location field, as shown in following image.

    Create Synonym Window

  7. Click Create Synonym.

    The Create Synonym status window appears, as shown in following image, indicating the synonym was created successfully.

    Create Synonym Status Window

  8. Click Close.

Top of page

Example: Creating an XML File

In the DMC:

  1. Right-click an application directory in the navigation pane and choose New, then Flow. The Data Flow tab opens in the workspace, with the SQL object displayed.
  2. Drag the DMORD object from the ibisamp application directory in the navigation pane into the workspace, to the left of the SQL object.
  3. Right-click the SQL object and select Column Selection.

    The Column Selection window opens.

  4. Use Ctrl + click to select ORDER_NUM, ORDER_DATE, STORE_CODE, PLANT, PROD_NUM, QUANTITY, and LINEPRICE, and click the right arrow to move them to the Selected Columns grid, as shown in following image.

    Column Selection Window

  5. Click OK.
  6. Drag the DMXORD object from the baseapp application directory in the navigation pane into the workspace, to the right of the SQL object.
  7. Double-click the DMXORD object.

    The Transformations window opens.

  8. Click the Automap button.
  9. Select the first row in Expressions panel, ORDER_NUM, and click the Adjust Expressions button. (In the XML target, the ORDER_NUM column is described as Decimal. This expression converts the character-valued column to a number.) Click OK.
  10. Click the Run button and select Run. A Save Changes dialog box opens. Click Yes.
  11. When the Remote File Name dialog box opens, enter dmxord2.xml in the File Name field and click OK. Wait for the request to complete.
  12. On Windows, you can view c:\ibi\apps\baseapp\dmxord.xml in Internet Explorer or an XML editor. In the example shown in the following image, note that the hierarchical structure of the source has been preserved. There is one ORDER_INFO element which contains multiple PROD_INFO elements.

    XML Window


iWay Software