Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Comparing 2 XML files

hi everyone,
i'm trying to compare two XML files that have the same structure. My question is: How can i do to show the difference between the two XML files. Any solutions?
Best regards.
Pegaz
Labels (3)
43 Replies
Anonymous
Not applicable
Author

hello,
I need to compare 2 XML files. Actually, I can do this, show if the files differ or not and how many lines do they differ.
My question is: How can i identify which row do they differ and what is the id. Let's consider this example:
xml1: xml2:
id= 12 id= 12
first_name= MACKLEY first_name= MACKLEY
last_name= bob last_name= david

I want to see as a result: the 2 XML files differ/ they differ on: last_name / the id= 12
Regards.
Pegaz
Anonymous
Not applicable
Author

I'm thinking that it would be a really good idea to developp a new component that permits to compare two files row by row.
Please wait for a talend team opinion but I think it will be an option to put it into the buggtracker
Anonymous
Not applicable
Author

i'm trying to switch to an other solution using tmap.
tFileInputXML_1--------->
tMap_1----------> tLogRow_1
tFileInputXML_2--------->
any suggestions?
thank's
Anonymous
Not applicable
Author

do you have many fields to compare?
Anonymous
Not applicable
Author

no, only 2 fields at this moment.
Anonymous
Not applicable
Author

Do u know how to compare two fields using tmap? and return a message saying for instence: the files differ If both of fields aren't the same and , the files are the same if they are.??
Anonymous
Not applicable
Author

ok so it exists a solution with a tMap but it's quite heavy...
You can use the tmap if you are sure that your id won't change at any moment.
You use a filter :
for the first flow :
!row1.first_name.equals( row2.first_name)
for the second :
!row1.last_name.equals(row2.last_name )
After you can set your output fields to :
first:
"issue in id "+row1.id+" : "+row1.first_name+" different to "+row2.first_name
second:
"issue in line "+row1.id+" : "+row1.last_name+" different to "+row2.last_name
Anonymous
Not applicable
Author

could you put a screenshot of ur job plz?
Anonymous
Not applicable
Author

of course, I use 2 csv files a two output
Anonymous
Not applicable
Author

i have this error message: cannot convert string to integer when i put: "issue in line "+row1.id+" : "+row1.first_name+" different to "+row2.first_name