Generic XML Import Data Containers Example

The following is an example of an XML Import for a customer record that contains an ID, Name, Status attribute, which uses [?Source?] instructions, while the Email Addresses and Phone Numbers nodes are mapped to data containers in STEP using the [?MultiSource?] instruction in the XML template below.

Input Document

Copy the following text to a new file and save it as an XML file. Open the Import Manager and select the file as the Data Source Filename and click 'Next.'

Note that any number of additional items can be included by repeating the data within the Customers node, but in this example, there is only one customer.

Copy
<?xml version="1.0" encoding="UTF-8" ?>
<Customers>
 <Customer>
<ID>EXT-4500-01</ID>
<Name>John Smith</Name>
<Status>Active</Status>
<Emails>
 <Email Type="Work" Unsubscribe="false">john.smith@stibosystems.com</Email>
 <Email Type="Personal" Unsubscribe="false">john.smith@gmail.com</Email>
 <Email Type="Other" Unsubscribe="true">jsmith@yahoo.com</Email>
</Emails>
<PhoneNumbers>
 <PhoneNumber Type="Work" AreaCode="555">4567890</PhoneNumber>
 <PhoneNumber Type="Mobile" AreaCode="555">3239897</PhoneNumber>
</PhoneNumbers>
 </Customer>
</Customers>

Template

In this template:

  • The XML declaration (the first line that indicates the XML version) was removed

  • Redundant Email and PhoneNumber nodes in the Emails and PhoneNumbers nodes have been removed.

  • The <?Record?> definition is added inside the first Customer node.

  • The instruction <?Source?> replaces values for 'ID', 'Name', and 'Status', using the optional identifiers of 'FullName' and 'CustomerStatus' in 'Name' and 'Status', respectively.

  • In the 'Emails' and 'PhoneNumbers' nodes, the [?MultiSource?] and <?MultiSource?> instructions are added in place of the values for each of the element and attribute values within the respective nodes.

Copy
<?xml version="1.0" encoding="UTF-8" ?>
<Customers>
 <Customer>
<?Record?>
<ID><?Source?></ID>
<Name><?Source?></Name>
<Status><?Source?></Status>
<Emails>
 <Email Type="[?MultiSource?]" Unsubscribe="[?MultiSource?]"><?MultiSource?></Email>
</Emails>
<PhoneNumbers>
 <PhoneNumber Type="[?MultiSource?]" AreaCode="[?MultiSource?]"><?MultiSource?></PhoneNumber>
</PhoneNumbers>
 </Customer>
</Customers>

This results in the following preview within the Select Format step of the Import Manager wizard, where values from the 'Emails' and 'PhoneNumbers' nodes are concatenated with a semicolon separator. There are three email addresses and two phone numbers in the XML, each represented by the semicolon separated values in each column. While these could also be imported as references with metadata, in this case, two data containers configured for entity objects are mapped.

Conversion Preview

Click the Sample reload button . The Conversion Preview area displays the results of the input document against the provided template.

After clicking the Next button, the mapping step is presented where the ID, Name, and Status attributes have been mapped. To map the next three columns, the Data Container mapping uses the same Data Container type that is relevant for Customer Email addresses.

On the 'Map Email Address to' dialog, select the relevant attribute, check the 'Use Auto-ID' checkbox, and change the Data Container separator from the default of # to ;. Click OK and the values are recognized as multiple rows in the data container. The same process is used for the next two columns, with relevant attributes selected.

In the next three columns, make mappings related to the Customer Phone Numbers using a different Data Container type. When switching types, the separator resets to the default.

When the import completes successfully, the new Customer is created with data containers populated as defined in the XML document: