You could write something like the code below, which is very simple but probably not easily extensible, or write at the Connection level, have just one twig_handler for the connection, extract whichever info you need from the tree for that element, then purge it and be done. The methods used in the code below should help you write a better version.
#!/usr/bin/perl use strict; use warnings; use XML::Twig; XML::Twig->new( twig_handlers => { Sender => sub { print "sender: ", + $_->text, "\n"; }, Receiver => sub { print "receiver: +", $_->text, "\n"; }, FileType => sub { print " file: ", + $_->first_child->tag, "\n"; $_->purge; }, }, ) ->parsefile( "fdata.xml");
In reply to Re: Get XML content using XML::Twig module
by mirod
in thread Get XML content using XML::Twig module
by kalyanrajsista
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |