in reply to Extract XML data using xml :: simple
The use of this module in new code is discouraged.An alternate is XML::Twig
use warnings; use strict; use XML::Twig; my $str = ' <GroupsResponse> <Status>Success</Status> <Group resourceId="183837" id="11797" name="Test" description="" l +ocation=""> <ResourcePrototype id="10001" name="Cave"/> <Resource id="101052" name="ABC"/> <Resource id="101082" name="DEF"/> <Resource id="101094" name="GHI"/> </Group> </GroupsResponse> '; my $t = XML::Twig->new( twig_handlers => { Resource => sub { print $_->att('name'), "\n"; +} }, ); $t->parse($str); __END__ ABC DEF GHI
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extract XML data using xml :: simple
by Ping_Bee (Initiate) on Oct 01, 2015 at 11:40 UTC | |
by Corion (Patriarch) on Oct 01, 2015 at 11:43 UTC |