Merging N number of XML files.

One Star

Merging N number of XML files.

I have CSV that I want to transform to an XML file, but it is a complex file with multiple groups and a loop. The CSV looks like this:
"Root",,,,,,
"Group1",,,,,,,,,,,,,,,,,,
"Group2",,,,,
"Loop",,,,,,,,,
"Element",,
Problem: The elements all contain a different amount of columns and the content has a different meaning.
The input is a tFileInputDelimited with pretty standard CSV settings, text enclosure is "\"".
I split using a tXMLMap to n outputs with a filter based on the first column value. After the splitting I want to merge them into a single XML file.
The required XML structure looks like this:
<Root>
<Group1>
<Group2>
<Loop>
</Loop>
</Group2>
</Group1>
<Element>
</Element>
</Root>
I have tried using a document output and just outputting strings, but the problem is that it always produces multiple (n) schemas, because of the columns issue.
I have tried both outputting the n XML files and then merging them using tUnite and tFileOutputAdvancedXML, but to no avail. I can't merge them with only a tFileOutputAdvancedXML, because it doesn't take the n inputs needed.
I also tried using n tBufferOutputs and then putting that into a tFileOutputAdvancedXML that was set to append, but because I have different schemas incoming I can't explicitly map to the output. This means the output xml would just contain empty elements or a broken XML, depending on the settings.
Is there any way to merge the n outputs or a component that can handle n input schemas to properly merge the split CSV rows? If not, is there a way to properly map the incoming CSV to the XML without splitting or merging?
One Star

Re: Merging N number of XML files.

I think your approach with n tButterOutputs is the right way to do it. Sadly for you tBufferOutput has a special function in Talend: transferring data between parent and child jobs. Also there is only one buffer.
You might want to use multiple tHashOutput and tHashInputs for that. That way you can read them into the tAdvancedFileOutputXML component.
Hope that helps
One Star

Re: Merging N number of XML files.

I think your approach with n tButterOutputs is the right way to do it. Sadly for you tBufferOutput has a special function in Talend: transferring data between parent and child jobs. Also there is only one buffer.
You might want to use multiple tHashOutput and tHashInputs for that. That way you can read them into the tAdvancedFileOutputXML component.
Hope that helps

The situation where I use the buffers is actually between parent and subjob, I also verified that one input receives the data from all the outputs. I already tried using hashInputs, but I will try it again.
Thank you for the input.
One Star

Re: Merging N number of XML files.

If all else fails use files to transport the data between jobs, if possible.