From: _why Date: 2006-11-23T02:22:11+09:00 Subject: Re: Hpricot/Rubyful Soup comparison On Thu, Nov 23, 2006 at 12:28:30AM +0900, Wes Gamble wrote: > My concern about "preserving original markup" has to do with this > application I'm writing, which grabs a page and then tries to display > it. When RubyfulSoup would encounter bad HTML, it could parse it ok, > but it always attempts to fix it when I went to write the parse tree. > Which can cause problems when you try to redisplay the HTML. I totally agree with you regarding preserving the original markup. In fact, the latest Hpricot code (in subversion) has two methods for output: * `to_html` which outputs fully closed tags and strips out bogus end tags. * `to_original_html` which outputs the original document (as close as it can) with your modifications made. So, for example, I use the `to_original_html` method in MouseHole, which is a scriptable personal HTTP proxy (sort of like greasemonkey). Some pages (like Boing Boing, for instance) completely break if you try to fix up the HTML. But this new method can successfully remove stuff and alter stuff without turning the whole page upside-down. _why