[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: HTML-Parser / SGML-Parser

Zach Dennis

10/1/2003 4:46:00 PM

I'll check it out! When you say simple, can I extract data from forms in
html page by chance?

Thanks,

-Zach

-----Original Message-----
From: Ben Giddings [mailto:bg-rubytalk@infofiend.com]
Sent: Wednesday, October 01, 2003 12:43 PM
To: ruby-talk ML
Subject: Re: HTML-Parser / SGML-Parser


Zach Dennis wrote:
> I am using the html-parser, sgml-parser and formatter ruby libraries
> provided from raa and I have made the changes to the regexp regarding
image
> width and height. So I'm good there.

I think the HTML parser might be abandoned (RAA says the last update was
2001-07-10 13:35:40 GMT).

You might have better luck using (my) htmltokenizer. It has a really
simple interface, and it might be more what you need:

http://raa.ruby-lang.org/list.rhtml?name=htm...

If you really want to use the html-parser, sorry, I can't help you. I
never managed to understand how to work it, which is why I ported the
htmltokenizer.

Ben




1 Answer

Ben Giddings

10/1/2003 5:00:00 PM

0

Zach Dennis wrote:
> I'll check it out! When you say simple, can I extract data from forms in
> html page by chance?

You should be able to.

If you say:

while token = tokenizer.getTag('input')
next unless 'ip_addr' == token.attr_hash['name']

puts token.attr_hash['value']
end

I think that will do what you want. I'm not sure if the syntax is perfect
since I'm doing this from memory, but it should be close enough to get you
started.

Ben