Iterate through multiple xml files with same schema

Seven Stars

Iterate through multiple xml files with same schema

Hello,

 

I have a folder that contain a list of xml files with the same schema.

 

file1.xml

file2.xml

...

...

...

file3.xml

 

-------

 

 

--file1.xml

<?xml version="1.0" encoding="UTF-8"?>
<debtors>
    <debtor>
        <clientNum>14069</clientNum>
        <debtorReferenceNumber>aa3373f5ae604ff883b3686086626d</debtorReferenceNumber>
        <activityCode>53168</activityCode>
        <debtorName>Debtor_name_5441</debtorName>
     </debtor>
<debtors>

--file2.xml

<?xml version="1.0" encoding="UTF-8"?>
<debtors>
    <debtor>
        <clientNum>659789</clientNum>
        <debtorReferenceNumber>dfkshdfs sdfgjsd</debtorReferenceNumber>
        <activityCode>64511</activityCode>
        <debtorName>Debtor_name_657716</debtorName>
</debtor> <debtors> --Expected output <?xml version="1.0" encoding="UTF-8"?> <debtors> <debtor> <clientNum>14069</clientNum> <debtorReferenceNumber>aa3373f5ae604ff883b3686086626d</debtorReferenceNumber> <activityCode>53168</activityCode> <debtorName>Debtor_name_5441</debtorName> </debtor> <debtor> <clientNum>659789</clientNum> <debtorReferenceNumber>dfkshdfs sdfgjsd</debtorReferenceNumber> <activityCode>64511</activityCode> <debtorName>Debtor_name_657716</debtorName> </debtor>
<debtor>
...
...
...
</debtor> <debtors>

 

Can you advice please, how can i get the above expected output?

 

Thank you.


Accepted Solutions
Seven Stars

Re: Iterate through multiple xml files with same schema

Hi asadasing,

 

Please follow the below steps - 

 

1) Add tFileList component to read all the files.

2) Add tFileInputXML component to extract the input xml content (extract to the fields - clientNum, debtorReferenceNumber etc..).

3) Add tUnite to unite contents of the files.

4) At last add tAdvancedFileOutputXML component and configure the required XML there.

 

Hope that will help you !

 

 

Best Regards,

Abhishek


All Replies
Seven Stars

Re: Iterate through multiple xml files with same schema

Hi asadasing,

 

Please follow the below steps - 

 

1) Add tFileList component to read all the files.

2) Add tFileInputXML component to extract the input xml content (extract to the fields - clientNum, debtorReferenceNumber etc..).

3) Add tUnite to unite contents of the files.

4) At last add tAdvancedFileOutputXML component and configure the required XML there.

 

Hope that will help you !

 

 

Best Regards,

Abhishek

Four Stars

Re: Iterate through multiple xml files with same schema

Hi Abhishek,

 

If you have any blog or detail explanation regarding this requirement then please share with me.

 

thanks in advance

Pravin

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch