Something like:
use strict; use warnings; use XML::Twig; my $xml = <<XML; <root> <tag1> tag 1 data </tag1> <tag2> tag 2 data </tag2> </root> XML my $root = XML::Twig->new ( twig_handlers => { tag1 => \&process1, tag2 => \&process2, } ); $root->parse ($xml); sub process1 { print "Process1: " . $_->children_text () . "\n"; } sub process2 { print "Process2: " . $_->children_text () . "\n"; }
Prints:
Process1: tag 1 data Process2: tag 2 data
In reply to Re: XML::Simple to XML::Twig
by GrandFather
in thread XML::Simple to XML::Twig
by arunvelusamy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |