CRCarl has asked for the wisdom of the Perl Monks concerning the following question:
returns a hash reference -my $response = $s->invoke("disk-list-info");
The hash is an XML document, the Data::Dumper looks like this - (very truncated)print $response; returns - NaElement=HASH(0x84b3408)
I'd like to get this document "loaded" into XML::Simple or XML::Twig so I can access the data more easily. I have tried ;print Dumper($response) returns - $VAR1 = bless( { 'content' => '', 'name' => 'results', 'children' => [ bless( { 'content' => '', 'name' => 'disk-details', 'children' => [ bless( { 'co +ntent' => '', 'na +me' => 'disk-detail-info', 'ch +ildren' => [ + bless( { + 'content' => '0b.29', + 'name' => 'name', + 'children' => [], + 'attrvals' => [], + 'attrkeys' => [] + }, 'NaElement' ), + bless( { + 'content' => '20000011:C6C99699:00000000:000000 +00:00000000:00000000:00000000:00000000:00000000:00000000', + 'name' => 'disk-uid', + 'children' => [], + 'attrvals' => [], + 'attrkeys' => [] + }, 'NaElement' ), + bless( { + 'content' => '13', + 'name' => 'bay', ........................
I have tried a whole bunch of variations on that, including$xmldoc = XMLin($response); - This errors out with - read on filehandle failed: Can't locate object method "read" via packa +ge "NaElement" at /usr/lib/perl5/XML/LibXML.pm line 531. at /usr/lib/ +perl5/XML/LibXML/SAX.pm line 64 at /usr/share/perl5/XML/Simple.pm line 295
Any ideas? Thanks, CXMLin(\%response) - same error. \
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Send a hash reference to XML::Simple?
by Corion (Patriarch) on Jan 03, 2008 at 17:19 UTC |