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:

require ‘hpricot’
require ‘open-uri’

doc = open(“http://stackoverflow.com/”) { |f| Hpricot(f) }
text = (doc/“//*/text()”) # array of text values
puts text.join(“\n”)

On 20 May 2010 06:22, ahmy [email protected] wrote:

You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Nandri(Thanks in Tamil),
Amala S.

Amala S. wrote:

There are many ways.

One way is Hpricot gem.

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

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Thank you i found nokogiri is very helpful.