parse page using tokenizer

B

beth

i have written a slighly bastardized version of the class web page
which is given as an example of how to use the html tokenizer.

What I've written is:

def parse(host)
dict = { }
@body= host.getHTML()
if !@body
return
end
theTags = ['select','input']
for x in theTags do
tokenizer = HTMLTokenizer.new(@body)
while tag = tokenizer.getTag(x)
name = tag.attr_hash['name']
type = tag.attr_hash['type']
if name != nil then
dict[type]=name
end # if
end# while
end# for x
return dict
end # end parse

My problem is that parse will return all tag attributes of "type" (ie
"checkbox, "button", "hidden") except for those which are of type
"text". I haven't been able to figure out where I'm going wrong.

Thanks for the help,

Beth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top