Six 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.

1 ACCEPTED SOLUTION

Accepted Solutions
Six 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

1 REPLY
Six 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