I am trying to add html tag to an existing html file using HTML::TreeBuiler.
the problem is that the added tags isn't encoded after the output. everything els is
fine.
###########
my $tree = HTML::TreeBuilder->new;
$tree->no_space_compacting(1);
$tree->store_comments(1);
$tree->parse_file("f.html");
my $ele;
my $tag = '<tr><td>TEST</td></tr>';
for (@{ $tree->extract_links('a', 'href') }) {
my($link, $element, $attr, $tag) = @$_;
if ($link=~ m{/mylink\.htm}) {
$ele = $element;
last;
}
}
$ele = $ele->parent(); # td
$ele = $ele->parent(); # tr
my $r = $ele->postinsert($tag);
open F,">f.html";
print F $tree->as_HTML('<>&',' ',{});
close F;
$tree->delete;
the output in html turn out to be
<tr><td><b>TEST</b></td></tr>
what am i missing ?
Qiang
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com