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 predefined by an xml schema definition 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. An existing JSON document can also be used as a prototype for a synonym, which can then be used as a target.

Single-segment and multiple-segment schemas are supported.

This technique is divided into two parts. In the first part, you create a synonym for the XML file. In the second, you 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 (XML Schema Definition) 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.

Note: For more information about creating synonyms for XML, please see Using the Adapter for XML in the Adapter Administration manual.

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

    The Select adapter to configure or Select connection to create synonym dialog box opens.

  2. Select XML and click OK.

    The Select Document Instance for XML Synonym dialog box opens.

  3. Enter ibisamp/dmxord.xml as the location where the XML file is created, as shown in the following image.

    Select Document Instance for XML Synonym dialog box

  4. Click Next.

    Note: The Create Synonym based on Document button allows you to create a synonym using an XML document alone. This example is for an XML target, so the xml document does not exist yet. This option is used for an XML source where no XML Schema Definition is available.

    The Select Data Definition for XML Synonym dialog box opens.

  5. Click the ellipsis to open Data Definition Selection. Expand the Applications folder and ibisamp. Select dmxord.xsd and click OK. The name ibisamp/dmxord.xsd appears as the location of the XML Schema Definition that describes the xml target.
  6. Click Next.

    The Create Synonym for XML dialog box opens.

  7. Click Create Synonym.
  8. Click Close in the confirmation window.

Top of page

Example: Creating an XML File

For a complete example, see the ibisamp/dmordxml flow.

In the DMC:

  1. Right-click an application directory in the navigation pane, select New, and then click Direct Load Flow. The Direct Load tab opens.
  2. Drag the DMORD object from the ibisamp application directory in the navigation pane into the workspace, to the left of the line.
  3. Drag the DMXORD object from the baseapp application directory in the navigation pane into the workspace, to the right of the line.
  4. Double-click the DMXORD object.

    The Transformations window opens.

  5. Click the Automap button.
  6. 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.
  7. Click OK.
  8. On the Flow tab, in the Run group, click Run and select Submit. A Save Changes dialog box opens. Click Yes.
  9. When the Save Procedure as dialog box opens, enter dmxord2xml in the File Name field and click OK. Wait for the request to complete.
  10. On Windows, you can view c:\ibi\apps\baseapp\dmxord.xml in Internet Explorer or in 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