aqFile.Compare not matching XML files even though they are the same
Hi,
I've been using the aqFile.Compare method to compare the contents of two XML files (one that gets generated by Crystal reports) and another pre-validated XML report.
I've had instances when tests have failed where the method returns a error stating the XML files are different even though I have used Notepad++ to check for differences and there are none (I've attached the sample files).
Does anyone know whether there any differences that the method checks for that's no visible within the file?
Thanks
Adam
The files are the same and also do differ - the context is important.
If you compare byte by byte, i.e. a binary compare, they are one byte different in size. There is an additional non visible character after the "NINO" string:
</Text>
<Text Name="Text20"><TextValue>NINO
</TextValue>This is 0x0D and the other is 0x0D 0x0A - very common issue with different line endings. The size differs and that is enough to fail a binary compare. See image
Contextually, if you look at them as XML files and look at the content in that context, the relevant content is equal.
I suspect you need to do a line by line comparison but even that is not a true XML context sensitive comparison as different formatting may throw the compariosn off.. A proper comparison would be to parse the XML file with an appropriate driver or library and compare in the true context.
Hope that helps.
Harnek