in reply to XML::Simple help
Here is my try with XML::Twig.
use XML::Twig; my $hash; my $t= XML::Twig->new( twig_handlers => { charge => sub{ $hash->{$_[1]->{'att'}-> +{'code'} }=$_[1]->{'att'}->{'name'}}, }, ); $t->parse( '<charge-type-control> <charge code="FRT" name="frtamt"/> <charge code="SV1" name="savamt"/> <charge code="SV2" name="savamt"/> <charge code="SV3" name="savamt"/> <charge code="SV4" name="savamt"/> <charge code="SV5" name="savamt"/> </charge-type-control>'); print $_."\t".$hash->{$_}."\n" for keys %{$hash};
regards
Murugesan Kandasamy
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: XML::Simple help
by mirod (Canon) on Mar 08, 2005 at 07:16 UTC |
In Section
Seekers of Perl Wisdom