Parse HTML to text

Hi

Im trying to parse a HTML to raw text, is there any plugin or gem for this ? exactly im trying to parse an email response whether it's HTML or Text or both of them.

Thank you

There are many ways.

One way is Hpricot gem.

Check this link:

http://stackoverflow.com/questions/1243817/hpricot-get-all-text-from-document

require 'hpricot'
require 'open-uri'

doc  = open("[http://stackoverflow.com/](http://stackoverflow.com/)") { |f| Hpricot(f) }

text = (doc/"//*/text()") # array of text values

puts text.join("\n")

Amala Singh wrote:

There are many ways.

One way is Hpricot gem.

That's true, but I think most people are using Nokogiri these days.

Best,

Thank you i found nokogiri is very helpful.