[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Extracting HTML

Dan Diebolt

5/11/2008 6:50:00 PM

[Note: parts of this message were removed to make it a legal post.]

require 'hpricot'

doc=Hpricot("<h1>Hello World</h1>")
doc.inner_text
=> "Hello World"

2 Answers

Jordi Aragones vilella

5/11/2008 7:21:00 PM

0

Dan Diebolt wrote:
> require 'hpricot'
>
> doc=Hpricot("<h1>Hello World</h1>")
> doc.inner_text
> => "Hello World"



Hi!! Thanks a lot for your answer. I'm a newbie and I still need to
learn a lot from Ruby and his libraries...

It worked fine!! And now, I will deep a bit in this library, because I
suppose that with that one, I will be able to save some tags for my PDF
code, isn't it? (For example, bold, underline...).

Thanks again for your answer! :)


--
Posted via http://www.ruby-....

Phlip

5/11/2008 7:55:00 PM

0

Jordi Aragones vilella wrote:

>> require 'hpricot'

> Hi!! Thanks a lot for your answer. I'm a newbie and I still need to
> learn a lot from Ruby and his libraries...
>
> It worked fine!! And now, I will deep a bit in this library, because I
> suppose that with that one, I will be able to save some tags for my PDF
> code, isn't it? (For example, bold, underline...).

Use a SAX-style XML parser to parse your strings as XHTML. SAX means the
parser calls a method for each tag it finds, so if you bind a <b> or <u> tag
you can stream the contents into PDF.

Now google for [ruby xml sax], because I don't know what Ruby's SAX solution
is!

--
Phlip