# Correcting HTML in Ruby

**URL:** <https://www.ruby-forum.com/t/correcting-html-in-ruby/64054>\
**Category:** Ruby\
**Created:** [June 21, 2006, 5:53pm UTC](https://www.ruby-forum.com/t/correcting-html-in-ruby/64054 "2006-06-21T17:53:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![roland](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ab097/32.png) [@roland](https://www.ruby-forum.com/u/roland)\
**Post date:** [June 21, 2006, 5:53pm UTC](https://www.ruby-forum.com/t/correcting-html-in-ruby/64054/1 "2006-06-21T17:53:28Z")

</div>

Hello,

I need to get content out of files which have incorrect HTML.  
Is there any library that does that?

I have been looking for a HTML-\>XML library but all attempts I have made  
have been futile.

Thanks for your time,

Roland

---

<div class="post-metadata">

**Author:** ![roland](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ab097/32.png) [@roland](https://www.ruby-forum.com/u/roland)\
**Post date:** [June 21, 2006, 6:34pm UTC](https://www.ruby-forum.com/t/correcting-html-in-ruby/64054/2 "2006-06-21T18:34:32Z")

</div>

On 6/21/06, Roland M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I need to get content out of files which have incorrect HTML.  
> Is there any library that does that?

It’s not exactly what you’re looking for but the W3C has a tool called  
HTML Tidy [1] which may be of help. It can fix a lot of brain damaged  
HTML, and even does wonders for the horrible HTML generated by MS  
Word.

[1] [Clean up your Web pages with HTML TIDY](http://www.w3.org/People/Raggett/tidy/)

---

<div class="post-metadata">

**Author:** ![roland](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ab097/32.png) [@roland](https://www.ruby-forum.com/u/roland)\
**Post date:** [June 21, 2006, 8:30pm UTC](https://www.ruby-forum.com/t/correcting-html-in-ruby/64054/3 "2006-06-21T20:30:34Z")

</div>

On Jun 21, 2006, at 16:53, Roland M. wrote:

> Hello,
> 
> I need to get content out of files which have incorrect HTML.  
> Is there any library that does that?
> 
> I have been looking for a HTML-\>XML library but all attempts I have  
> made  
> have been futile.

There was an article on doing something like this posted to the list  
a short while back:  
[http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/197214](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/197214)

It seems to give a good overview of a few different solutions.

best of luck,  
matthew smillie.
