4

For example, I want the following to be considered same.

<div id="div" class="txt">
   Foo bar
</div>

and

<div   class="txt"                          id="div"          >Foo bar</div>

I have searched with diff and html, I found diff tool show it's diff result in HTML.

Thanks for your interest.

some_other_guy
  • 3,364
  • 4
  • 37
  • 55
Solip
  • 43
  • 4
  • these two codesnippets should have no diff in the rendered html (perhaps having an additional whitespace-textnode)so a difftool comparing the diff-results should be pretty much be the thing you are looking for? – Christoph Aug 27 '12 at 08:09
  • @Christoph thank you. I agree with you. – Solip Aug 28 '12 at 04:08
  • @starbeamrainbowlabs "Why" isn't really relevant, I think the point is that the OP wants to compare structure and ignore irrelevant representational artifacts. – Dave Newton Sep 03 '12 at 18:43

1 Answers1

0

I wrote a tool to do this at http://prettydiff.com/ but be sure to select HTML from the language list, because the auto detection will attempt to treat your HTML code as XML.

austincheney
  • 1,189
  • 9
  • 11
  • I already tried prettydiff. It`s good at space handling, but attribute order is not. I tested again with "

    " and "

    ". If prettydiff is ignore attribute order, it will be perfect to me.

    – Solip Aug 30 '12 at 13:19
  • Thank you for the suggestion. I will work this change into the application. – austincheney Aug 30 '12 at 15:53
  • @Solip could you check out your suggestion in a beta update to see the tool does what you need: http://prettydiff.com/testlocation/ – austincheney Aug 31 '12 at 01:36
  • It seems work same as expected. Thank you for your effort. – Solip Aug 31 '12 at 08:22
  • I wanted to compare the structure ignoring all content. Unfortunately I couldn't get that to work with the option "ignore content". – Benny Bottema Apr 08 '21 at 19:49