Preparing an XML File for Import

Preparing an XML File for Import

XML (Extensible Markup Language) is a powerful format for handling complex or hierarchical data. Because XML files can have virtually any structure, they must go through a Data Transformation step to be processed by the Import Module. While any valid XML can be used as a source, this guide describes a recommended structure for predictable results.

How XML is Handled for Transformation

Unlike JSON or CSV files that are converted into a standard format, your uploaded XML file is used directly as the source for the Data Transformation. The system does not add any wrapper elements. Your transformation stylesheet (XSLT) will therefore need to match the root element of the file you provide.

For example, if you upload an XML file that starts with a <students> root element, your transformation's main template should match <students>.
To make your data transformation logic easier to write and manage, we recommend a clear and consistent structure for your source XML files. A good practice is to have a single root element (e.g., <records>) that contains a series of identical child elements for each person or record (e.g., <record>).

Example: XML with Repeater Data

This example uses the recommended structure. The root element is <records>, which contains two <record> elements. To handle a repeater, we've nested a collection of <contact> elements inside an <EmergencyContacts> element.
  1. <records>
  2.   <record>
  3.     <StudentID>4876</StudentID>
  4.     <PrimaryContact>Maria Garcia</PrimaryContact>
  5.     <EmergencyContacts>
  6.       <contact>
  7.         <name>Maria Garcia</name>
  8.         <phone>555-0101</phone>
  9.       </contact>
  10.       <contact>
  11.         <name>Luis Garcia</name>
  12.         <phone>555-0102</phone>
  13.       </contact>
  14.     </EmergencyContacts>
  15.   </record>
  16.   <record>
  17.     <StudentID>3451</StudentID>
  18.     <PrimaryContact>John Chen</PrimaryContact>
  19.     <EmergencyContacts>
  20.       <contact>
  21.         <name>John Chen</name>
  22.         <phone>555-0201</phone>
  23.       </contact>
  24.     </EmergencyContacts>
  25.   </record>
  26. </records>
In your Data Transformation, you would write the logic to loop through each <record> element, and within that, loop through each <contact> element to format the data for import.

Next Steps

Now that you understand how to structure your XML file for transformation, you're ready to learn about the main interface where you will manage all your import configurations.

Next Article: Understanding the Import Dashboard