in reply to Extract XML data using xml :: simple

Don't use XML::Simple because its author states:
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
    This XML:Twig module is not present in our environment..so can anyone help with XMl:SIMPLE

      What Perl code have you written already to accomplish your task using XML::Simple? Mostly, you will need to take special note of the ForceArray argument and ideally force every element in your XML into an array.