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
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