DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Perl XML::Twig (very Simple Example)
Using XML::Twig
use XML::Twig;
my $xml = '<?xml version="1.0" ?>
<page id="1">
<content>
This is <div class="red">some HTML text</div>
</content>
</page>';
my $twig = XML::Twig->new(
twig_handlers => {
content => sub { $_->print; print "\n"; },
},
);
$twig->parse($xml);
$twig->purge;





