Using XML::Twig
, is there a way to get the entire HTML of a node? I do not want the text of the node, but the entire HTML with tags and all.
input XML
<content> <p>blah blah <b> bla bla </b> </p>
<p> line 2 <i> test </i? </p>
</content>
Code
my $twig = new XML::Twig(
TwigRoots => {'content' => 1},
TwigHandlers => $twig_handlers
);
my $twig_handlers = {'count/p' => \&count_ps};
sub count_ps {
my ($twig, $test) = @_;
$Data .= $test->text();
}
$data
should show me the entire HTML.