Creating Complex XML from Flat Data
Dataflows often produce records containing flat fields which get written to XML as a simple XML elements. If you want to organize flat fields into complex XML elements to produce hierarchical data, you can do so using one or more Aggregator stages.
For example, given this flat data where the first line is a header record:
addressline1,age,city,country,gender,name,number,postalcode,stateprovince,type
1253 Summer St.,43,Boston,United States,M,Sam,019922,02110,MA,Savings
You might want to group the fields of data related to the address and fields related
to the account into complex XML elements named <Address>
and
<Account>
as shown here:
<CustomerRecord>
<name>Sam</name>
<age>43</age>
<gender>M</gender>
<country>United States</country>
<Address>
<addressline1>1253 Summer St.</addressline1>
<city>Boston</city>
<stateprovince>MA</stateprovince>
<postalcode>02110</postalcode>
</Address>
<Account>
<number>019922</number>
<type>Savings</type>
</Account>
</CustomerRecord>