Dan Muey wrote:

> 
> It won't grab/parse img tags that are between <a> tags, IE an image that
> is a link. I tried having it parse <img>'s first then <a>'s but that
> didn't work. Any thoughts??
> Thanks for all you r help!
>

what do you mean? the following seems to be working:

#!/usr/bin/perl -w
use strict;
 
use HTML::TokeParser;

my $tok = new HTML::TokeParser(*DATA) || die $!;
while(1){
        my $token = $tok->get_tag("a","img");
        last unless($token);
        if($token->[0] eq 'a'){
                print $token->[1]{href} || "what?","\n";
        }else{
                print $token->[1]{src} || "again?","\n";
        }
}

__DATA__
<html>
<body>
<a href=link1>link1</a>
<img src=img1>img1</img>
<a href=link2><img src=img_inside_a></img></a>
</body>
</html>

prints:

link1
img1
link2
img_inside_a

so img_inside_a does show up. am i missing something?

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to