Are there any tools out there to compare the structure of 2 web pages?

。_饼干妹妹 提交于 2019-11-30 10:29:06

You can use HTMLTidy to convert the HTML to well-formed XML so you can use XML Diff, as Gulzar suggested.

tidy -asxml index.html

If out output XML compliant HTML. Or at least translate your HTML product into XML compliancy, you at least could then XSL your output to remove the content and id tags. Apply the same transformation to their html, and then compare.

I was thinking on lines of XML Diff since HTML can be represented as an XML Document. The challenge with HTML is that it might not be always well formed. Found one more here showing how to use XMLDiff class.

elhoim

A copy of my own answer from here.


What about DaisyDiff (Java and PHP vesions available).

Following features are really nice:

  • Works with badly formed HTML that can be found "in the wild".
  • The diffing is more specialized in HTML than XML tree differs. Changing part of a text node will not cause the entire node to be changed.
  • In addition to the default visual diff, HTML source can be diffed coherently.
  • Provides easy to understand descriptions of the changes.
  • The default GUI allows easy browsing of the modifications through keyboard shortcuts and links.

winmerge is a good visual diff program

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!