Are you coding in JAVA to make the comparison?
I was using VBScript but the idea is the same. I used XML objects. I Opened the files with the objects. Then I compared branch to see if elements, values, attributes, attribute values are the same. I have examples on this site from a couple of years ago on how to do this.
There must be tools in the JAVA environment that can do a lot of this work for you. I'm not sure how to find them.
When in Florida, Don't Tampa with the code. I made this up.