in reply to XML::Twig Search
use strict; use warnings; use XML::Twig qw( ); my $twig = XML::Twig->new( twig_roots => { 'Application[Properties/Timeout]' => sub { my ($t, $elt) = @_; print("$elt->{att}{Name}\n"); $t->purge; } }, ); $twig->parsefile('a.xml');
This works:
use strict; use warnings; use XML::Twig qw( ); my $twig = XML::Twig->new( twig_handlers => { 'Application/Properties/Timeout' => sub { my ($t, $elt) = @_; print($elt->parent->parent->att('Name'), "\n"); }, }, ); $twig->parsefile('a.xml');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Twig Search
by Gizmo (Novice) on May 17, 2010 at 20:40 UTC |