| || |
How to compare HTML files?
Is somebody has a tool to compare 2 HTML files, more efficiently/understandable than SYS_CompareText or Binary?
Re: How to compare HTML files?
Depends what you mean by "compare"
With most text formats, what I will normally do is keep a good difference analyzer around (WinDiff or the like). If the simple comparison doesn't match, I copy the two files to a safe area, and create an entry in the results file which will launch the analyzer on those files (see "raise statement" in the language reference). If you need to have the differences in the results file itself, you may be able to call your analyzer using SYS_Execute, copying the output into a list which you then print.
But that's checking that two files are equal. If instead, you want to check that two files are equivalent... that's a lot harder. There exists a perl module for parsing HTML elements, so you could, I suppose, write a pl file to build an element tree, then check element by element to confirm that the files are "close enough"
A compromise between the two might be to compare the actual results against a regular expression mask (again, using perl). This can get pretty squirrelly if you have to worry about equivalent sections that span different numbers of lines.