I have two xml files (a.xml and b.xml) in my file system (iPhone). Now I want to know if these files contain exactly the same data. In most cases, this comparison would be true, since b.xml is the result of the copyItemAtPath: operation. If it will not be overwritten with new information. What would be the most efficient way to compare these files?
- I could read the contents of files as strings and then compare strings
- I can analyze files and compare some key elements
- I think there is a very dumb way that does not need to interpret the file, but allows me to compare at a lower level.
Any suggestion is very welcome.
thanks in advance
Sjakelien
Update:
I ended up with this:
oldData = [NSData dataWithContentsOfFile:PathToAXML];
newData = [NSData dataWithContentsOfFile:PathToBXML];
and then compare it with:
[newData isEqualToData:oldData]
: , :
oldData = [NSString dataWithContentsOfFile:PathToAXML];
newData = [NSString dataWithContentsOfFile:PathToBXML];
[newData isEqualToString:oldData]