Hi,
I'm new to HTML::Tokeparser and have tried the standard examples but can't
seem to get and link references to tags within tags - basically there is some
table data, and "a href" titles within that table data. Since since the "a
href" links relate to the table data I need to associate these as I grab
them, rather than doing separate walkthroughs of the tokens.
I have some html that looks like this:
>>>>>>
<td width=30>
<a href="http://www.someurl" OnMouseOver="return
(this.title)" title="Some text that needs to be associated with the value in
this table cell, ie. 54">
54 </td>
<td bgcolor="#FFFFFF" class="BC2"> </td>
<td>
<a href="a href="http://www.someurl" OnMouseOver="return
(this.title)" title="Some other text that needs to be associated with the
value in this table cell, ie. 79">
79
</td>
<td>
#Also need blank cells
</td>
>>>>>>
I am using this Tokeparser code to get the text within the table tags but
don't know how to get and associate the "a href" tags within that:
#!/usr/bin/perl
use HTML::TokeParser;
$p = HTML::TokeParser->new("$filename");
while (my $tag = $p->get_tag("td")) {
#how to grab the "a href" title info too, and associate it with the
corresponding cell value captured between "td" tags??
my $result = $p->get_trimmed_ text("/td");
$result =~ s/^\s+//g;
print "$result";
}
Any help appreciated.
Thanks
Colin