HOW TO MERGE 2 XML IN A SINGLE FILE

Seven Stars

HOW TO MERGE 2 XML IN A SINGLE FILE

Hi all,

I have 2 Input XML files which look like bellow:

 

File1 (file also in attach)

ptlink.png

 

File2 (file also in attach)
journey.png

 

 

 

 

 

 

 

 

Output file desired (file also in attach)
result.png

 

 

 

 

 

 

 

 

Thank you for help

 

 

 


Accepted Solutions
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

Hi All,

I found finally solution to my issue, 2 ways to solve it

 

Solution 1 :

Create 1 first output with all good and with only one iteration.

After that make a mapping in a tmap to generate a second iteration that will be write in first output with option write after  

 

Solution 2 :

Use component tFileOutputMSXML to make all loop

 

Thanks,


All Replies
Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2,if the Name would be same in bothe XML's.then implemnt in the below way by join on Name

Untitled.png

Manohar B
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

Hi,
How to do it please, I have this idea but i try to map both file in a txmlMAp i got error
Thanks
Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

Hi,please find below.i was doing join on skuid.

Untitled.pngUntitled.png

Manohar B
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

Hi Manohar B,

That is exactly what i try to do, mapping both xml file to generate output XML File.

 

Find bellow my config of tFileInputXML componentInputxml.png

 

 

 

 

 

 

 

 

 

Find bellow my config of tXMLMap component
map.png

 

 

 

 

 

 

 

 

 

 

But my output file is blank

 

Thanks,

 

Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2,can you able to provide smaple source file?

Manohar B
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

Hi,

Already provided in attached of my first post

Check it please

 

Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2,what is the data type for "creationTime" from second file?

Manohar B
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

It is currentDate that i put in global variable.

Don't worry about it, i put all field in string

 

 

Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2,it was not getting values when i tick GetNodes in Basic settings>>Mapping of tFileInputXML.

 

so can you uncheck GetNodes in both tFileInputXML's and check?

Manohar B
Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2,still do you have issue?

Manohar B
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

When i uncheck get Node, i get error bellow

Error Config: "Get Nodes" should be checked when type is "Document"
[ERROR]: vo2.job_de_test_0_1.Job_de_test - tFileInputXML_1 - Error Config: "Get Nodes" should be checked when type is "Document"

But by check it, i can read input file

Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2,check with below i am getting.with you provided files and you can chech tFilInputXML settings also.

Untitled.pngUntitled.png

Manohar B
Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2,what is the Loop XPath query in tFileInputXML?

 

can you use "/tototiti/ChouetteRoute" as Loop XPath query in tFileInputXML and let me know?

Manohar B
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

By configured tFileInputXML like your screnshot, you cant' have a XML tree in your tXMLMap component i mean

 

map2.png

 

 

 

 

 

 

 

 

 

Could you show me your txmlMap screenshot ?

Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

In my txmlmap,I do not have XML structure,since you can join objextId.
Manohar B
Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2,still if you have issue let me know ,i will provide Job export.

Manohar B
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

Hi,

I still have issue, you can send it please.

In your job, your output is an XML file? And you get the same result like attached file ?

 

Thank you for help

Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2,please find the attahced job export.

Manohar B
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

Thanks i check it and make you a feedback
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

HI,

I just import your job, so thanks.

Anyway, i will put a tfileoutputXML in place of tLogRow component, but i am not sure this resolve my issue.

Because problem is not just merge 2 xml file, but get both iteration of each source file like this screenshot already sent.

 

result.png

 

 

 

 

 

 

 

 

 

Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2,check the below link,you can specify the looping too.

https://help.talend.com/reader/WWQ40R_iTE5~~9VkUQrjgQ/i_YvOl2oUaVpW1UTnJao_g

Manohar B
Thirteen Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

@idembele2.still do you have issue?

Manohar B
Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

Hi Manohar B,

Yes still get issue, but i have not check your link.

I check it today and let you know.

 

Thanks,

Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

Hi,

Please forget my previous mail, i know this component and already test it.
It permit to make just one iteration but not 2 like i desire

Seven Stars

Re: HOW TO MERGE 2 XML IN A SINGLE FILE

Hi All,

I found finally solution to my issue, 2 ways to solve it

 

Solution 1 :

Create 1 first output with all good and with only one iteration.

After that make a mapping in a tmap to generate a second iteration that will be write in first output with option write after  

 

Solution 2 :

Use component tFileOutputMSXML to make all loop

 

Thanks,