tanger has asked for the wisdom of the Perl Monks concerning the following question:
<div class="text12">This text I don't need.</div> <div class="text12">This long test that is at least 201 characters in +length is what I want to parse. <br><br> Here is a list that I want to retrieve in this "div" tag.<br> List:<br> <li>item 1 <li>item 2 <li>item 4 <div>
while( $token = $stream->get_token) { if ($token->[0] eq 'S' and $token->[1] eq 'div' and ($token->[2]{'clas +s'} || '') eq 'text12') { $description = $stream->get_trimmed_text('/div'); $num = length($description); if ($num > 200) { print "$description<br><br>"; } } }
Thanks!#description value: Here is a list that I want to retrieve in this "div" tag. List:item 1 item 2 item 4 #I want to take the description value and print it out as HTML but sin +ce the <li> tags aren't entact, I can't properly display the list in +a browser.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML TokeParser - help with using get_text, get_trimmed_text
by tachyon (Chancellor) on Nov 10, 2004 at 00:59 UTC | |
|
Re: HTML TokeParser - help with using get_text, get_trimmed_text
by steves (Curate) on Nov 10, 2004 at 00:30 UTC |