Parsing nested XML into single row

I have a source XML file that I’d like to be able to parse into a single row of data for export as csv/delimited file.

Right now when I import the file, it’s creating multiple rows with missing data in most of the columns. A snippet of the XML is below.





The resulting import:

Is there a way to treat the hierarchy of the XML in such a way that can result in all of the data rolling up under the top level as a single row of data?

Hi Jason and welcome to the Community!

In a simple case, using the “Fill down” action should do the trick. However, if the structure of XML is not consistent, a more complicated method can be used. In the example below, I provided 2 methods how to flatten the XML you provided.

flatten-xml.morph (6.7 KB)
sample.xml (958 Bytes)

1 Like

Hi Jason,

i think it’s the same problem i also had several times.

regards ,


Problem at solution
above (flatten-xml) is if you have more than one occurence (1:n, Loops …) in der XML. In this case only the first occurrence is taken. Would be great if Easymorph could work on XSDs

with best regards,


@dgudkov - thank you! This is perfect and worked great when applied to the full XML file/format we’re working from. Separately, we’ve learned that the originating process for this file will potentially produce multiple files (each XML file representing a customer order), that would be delivered to us in a consistent directory location. If using the scheduler to process, is the best option to use the “List Files” action and then have it process with some conditions (specific file name, or when list is not empty…) to churn through the source files and process each ?

The idiomatic way to process multiple uniform files in EasyMorph is to use iterations (loops). Check out our tutorial on iterations here: EasyMorph | Iterations

Alternatively, you can use the “List files” action to produce a list of files in a specific location, then filter it (if necessary) using a filtering action in EasyMorph, then use the “Import from XML” action in the “Load multiple files” mode. The mode is described in this tutorial article (see the Advanced topics): EasyMorph | Loading files

If you choose to process multiple files at once, instead of iterations, you may need to adjust the logic in the example that I posted above because they are designed to work for one transmission (order). You may need to add grouping by file name so that operations are performed inside groups.