I have just started learning Ruby. Very cool language, liking it a lot.
I am using the very handy Hpricot HTML parser.
What I am looking to do is grab all the text from the page, excluding the HTML tags.
Example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Data Protection Checks</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div>
This is what I want to grab.
</div>
<p>
I also want to grab this text
</p>
</body>
</html>
I am basically wanting to grab only the text so I end up with a string like so:
"This is what I want to grab. I also want to grab this text"
What would be the best method of doing this?
Cheers
Eef