Support Questions

Find answers, ask questions, and share your expertise

NiFi Compare 2 xml files and create xml file with differences

avatar
Explorer

Hi all,

 

I have 2 xml files that I would like to compare from yesterday and now, then make a new xml file with only the difference between the 2 xml files.  This would be on 16k to 20k files daily.

 

I can see where I can split the file and parse, but nothing specific regarding comparing.  These xml files have over 100 individual elements.

 

Any help / suggestion to get started would be great. 

 

Thank you.

3 REPLIES 3

avatar

Perhaps you are looking for something simple, but comparing XML can be quite a complex topic in general. Therefore I don't expect this to become available in the form of a standard processor. 

 

I would recommend looking into a python script to do this, and then calling this from Nifi. 


- Dennis Jaheruddin

If this answer helped, please mark it as 'solved' and/or if it is valuable for future readers please apply 'kudos'.

avatar
Explorer

could do write of both files to a ms sql db and compare the 2 rows then generate an xml based on the difference? 

 

please let me know.

avatar

This is slightly confusing, but if you have a Mysql query to generate the difference, then Nifi can get the data from there and convert to XML if needed. 

 

As generating the difference seems to be the main challenge here, perhaps start by finding a way to do this, and from here it should be trivial to design the Nifi flow around this.

 

----

If this answers the question, consider marking this as the answer 


- Dennis Jaheruddin

If this answer helped, please mark it as 'solved' and/or if it is valuable for future readers please apply 'kudos'.