From: Robert Klemme Date: 2011-04-05T21:59:09+09:00 Subject: Re: Non-correcting library for parsing/modifying broken HTML/PHP files? On Tue, Apr 5, 2011 at 10:56 AM, Markus Fischer wrote: > does anyone know of a library which can work with broken/malformed HTML/PHP > and still produce the same output like the input? > > So far I've tried Nokogiri and Hpricot, they're absolutely amazing and excel > in their purpose but fail to meet my requirement that, when saving the HTML, > nothing which I haven't changed due DOM manipulation should change in the > output. > > The thing is that I've to work with such horrible broken HTML (or say, PHP) > documents that those libraries are über-tempted to correct it. But this is > troublesome for me, as I've fix a few hundreds, maybe up to thousands of > documents and their versioned history should really only reflect the change > I'm doing and not what the library needs to change so it can work with it. I > looked up at rubygems but was unable to come up with more libraries, did I > miss them? What about one initial rework to get proper (X)HTML, submit it to your version control and then create those modifications that you need to do? That approach has served me quite well for example when enforcing a particular source code formatting. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/