how to compare the text of two html pages
-
Hi , I want to compare the text of two html pages and then highlight the changed text.Do you have any idea on how to do this
-
Hi , I want to compare the text of two html pages and then highlight the changed text.Do you have any idea on how to do this
Are the pages similar ? That is, do they have the same layout except for the text ? Perhaps you can just load one, then compare the two as strings, and do an insert where text is different to make a new composite document ? Is it XHTML ? If it is, then you can do it by comparing XML nodes, and building a new document that highlights in one colour for stuff only in the first document, and another for stuff only in the second. The XML way is definately cleaner, if it's possible. Christian Graus - Microsoft MVP - C++
-
Are the pages similar ? That is, do they have the same layout except for the text ? Perhaps you can just load one, then compare the two as strings, and do an insert where text is different to make a new composite document ? Is it XHTML ? If it is, then you can do it by comparing XML nodes, and building a new document that highlights in one colour for stuff only in the first document, and another for stuff only in the second. The XML way is definately cleaner, if it's possible. Christian Graus - Microsoft MVP - C++
actually I need to check a two versions of the same page but if I compared the two versions as text I will not get an accurate result for instance maybe a picture has been changed and even the font size might change I just want to highlight the changed text
-
actually I need to check a two versions of the same page but if I compared the two versions as text I will not get an accurate result for instance maybe a picture has been changed and even the font size might change I just want to highlight the changed text
Then, is it XHTML ? Can you make it XHTML ? XHTML is HTML that is valid XML, it means you could load it into an XML document and compare it as XML. Christian Graus - Microsoft MVP - C++
-
Then, is it XHTML ? Can you make it XHTML ? XHTML is HTML that is valid XML, it means you could load it into an XML document and compare it as XML. Christian Graus - Microsoft MVP - C++
Thank you for your response. actually the page is a regular html page .DO you have any suggestions on how to highlight the changed text only.
-
Thank you for your response. actually the page is a regular html page .DO you have any suggestions on how to highlight the changed text only.
Mohsen Saad wrote: actually the page is a regular html page Can you convert it to XHTML ? All you need to do is make sure that the nodes match ( which they probably do ) and turn tags like <br&gr; into <br/&gr;. Otherwise, you're going to be parsing the nodes as well as the text. Christian Graus - Microsoft MVP - C++