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

 

 

 

21 REPLIES
Eleven 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
Eleven 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,

 

Eleven 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

 

Eleven 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

 

 

Eleven 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
Eleven 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

Eleven 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
Eleven 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 ?

Eleven 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
Eleven 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

Eleven 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

 

 

 

 

 

 

 

 

 

Eleven 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