in reply to Re^2: parsing html
in thread parsing html
!/usr/bin/perl use warnings; use strict; use HTML::TreeBuilder; my $html = do{local $/;<DATA>}; my $p = HTML::TreeBuilder->new; $p->parse_content($html); # parse_content if you have a string my @tds = $p->look_down(_tag => q{td}); # get a list of all the td tag +s for my $td (@tds){ my $bold = $td->look_down(_tag => q{b}); # look for a bold tag if ($bold){ print $bold->as_text, qq{\n}; # if there is one print the text } } $p->delete; # when you've finished with it
|
---|
Replies are listed 'Best First'. | |
---|---|
quite SOLVED Re^4: parsing html
by paola82 (Sexton) on May 15, 2009 at 09:10 UTC | |
by wfsp (Abbot) on May 15, 2009 at 09:28 UTC | |
by paola82 (Sexton) on May 15, 2009 at 10:19 UTC | |
by wfsp (Abbot) on May 15, 2009 at 11:00 UTC | |
by paola82 (Sexton) on May 15, 2009 at 11:26 UTC |