I want to compare two XML files, they are the same as each other. i have one of them in local storage and using bufferReader i put it on String and i get the other one from server and again put it into the String! then i Print the content of them and they are actually the same! nothing differs even spaces!! but when i compare them ( 2 strings) using equalsIgnoreCase they are not equal and always goes to else! which means they are not equal! can anybody help on this? if no way to compare like this so how can i compare them?
Asked
Active
Viewed 752 times
2 Answers
2
I think it happens due to formatting issue.
You can use XMLUnit to resolve the issue.
XMLUnit will help you in
- The differences between two pieces of XML
- The outcome of transforming a piece of XML using XSLT
- The evaluation of an XPath expression on a piece of XML
- The validity of a piece of XML
- Individual nodes in a piece of XML that are exposed by DOM Traversal

Tanmay Mandal
- 39,873
- 12
- 51
- 48
-
how can i add this to eclipse? – Mahdi Giveie Oct 26 '12 at 11:43
-
1This link will help you to resolve your problem http://stackoverflow.com/a/3643015/463721 – Tanmay Mandal Oct 26 '12 at 13:50
-1
Did you tried string1.equals(string2)

Arun Kumar
- 877
- 3
- 13
- 37
-
1He tried equalsIgnoreCase based on the question contents. How would this be better? – Don Roby Oct 26 '12 at 11:34