On Thu, Nov 23, 2006 at 03:57:51AM +0900, Wes Gamble wrote: > Actually, I'm kind of hoping that I can make mods. to the parse tree, > but that no "unnecessary fixing" of bad HTML occurs. > > So I'm wondering does modifying the parse tree at all and then > outputting it imply that all of the malformed HTML will be > fixed/modified in some way or not? With `to_original_html`, no malformed HTML is fixed. >> require 'hpricot' >> doc = Hpricot("<div><p>Paragraph one<p>Paragraph two <b>with <i>some</b> tags in it <b etc.=></p>") >> (doc/:p).set('class', 'new') >> puts doc.to_original_html <div><p class="new">Paragraph one<p class="new">Paragraph two <b>with <i>some</b> tags in it <b etc.=></p> With `to_html`, Hpricot will line up all the tags. _why