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.
- <records>
- <record>
- <StudentID>4876</StudentID>
- <PrimaryContact>Maria Garcia</PrimaryContact>
- <EmergencyContacts>
- <contact>
- <name>Maria Garcia</name>
- <phone>555-0101</phone>
- </contact>
- <contact>
- <name>Luis Garcia</name>
- <phone>555-0102</phone>
- </contact>
- </EmergencyContacts>
- </record>
- <record>
- <StudentID>3451</StudentID>
- <PrimaryContact>John Chen</PrimaryContact>
- <EmergencyContacts>
- <contact>
- <name>John Chen</name>
- <phone>555-0201</phone>
- </contact>
- </EmergencyContacts>
- </record>
- </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