Fellow monasterians,
New to HTML::Tokeparser (or any parser, for that matter).
I'm pulling xhtml-formatted content from a database for display in a browser. The browser is not rendering entities, in particular, those that follow tags that are not being rendered, namely closing xhtml tags that have no opening tags (badly formatted, I know, but I have no control over that).So, I running the content through HTML::Tokeparser first but it's not stripping out the delinquent tags.
Does the parser need the opening tag to work? Short of regex's, is there another way to do this? What am I missing? TIA!
use HTML::TokeParser; my $result; my $p = HTML::TokeParser->new(\$text); while ( my $token = $p->get_token ) { if ($token->[0] eq 'T') { $result.= $token->[1]; }
Before parsing:
</tr /> </tbody /> </table /></p> <p>We have different groups to help you through the buying proces +s. Our team of counselors and volunteers can provide transportat +ion, and childcare. </p> <p> </p>';
After parsing:
</tr /> </tbody /> </table /> We have different groups to help you through the buying process.& +nbsp;Our team of counselors and volunteers can provide transportation +, and childcare. ';
Note: It's getting the <p> tags.
In reply to HTML::TokeParser not stripping entities and xhtml by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |