XML::Simple Help?




I'm looking for a simple way to process results returned from a
website via XML. I was thinking XML::Simple should be simple... but
apparently I'm even simpler than it is!

I'm having trouble figuring out how to get at the four items it
returns. Looks like $tags contains a hash which is actually a data
structure named $VAR1, which appears to define a hash, but how do I
make it work? It looked empty, but Dumper shows the contents and they
look like exactly what I want... but how do I access it???

-----------------------------------
Test Code (response is copied from actual data):

#!/usr/bin/perl

use XML::Simple;
use Data::Dumper;
$content="<response>
<result>12</result>
<respmsg>Decline</respmsg>
<authcode>RE-PRESENTED CHK</authcode>
<pnref>99220</pnref>
</response>";
$tags = XMLin($content);
print "\n\nDumper:\n";
print Dumper($tags);

-----------------------------------
Results:


Dumper:
$VAR1 = {
'authcode' => 'LREADY USED',
'pnref' => '99220',
'respmsg' => 'Denied',
'result' => '12'
};
-----------------------------------

So... $tags contains what I'm looking for... now I need to be able to
use the four items!

Anyone?

.



Relevant Pages

  • Help in XML::Simple
    ... website via XML. ... Looks like $tags contains a hash which is actually a data structure named $VAR1, which appears to define a hash, but how do I make it work? ...
    (comp.lang.perl.modules)
  • Re: XML::Simple Help?
    ... duhhhh... ... Looks like $tags contains a hash which is actually a data ... >structure named $VAR1, which appears to define a hash, but how do I ... but Dumper shows the contents and they ...
    (comp.lang.perl.modules)
  • Re: Getting NASM from C
    ... > format we were going to edit it in... ... all XML is? ... HTML is a specific "subset" of XML for displaying ... it's a text file with "tags" inside ...
    (alt.lang.asm)
  • Re: Gotta start somewhere ... how many of us are really out there?
    ... if you are thinking of using XML ... pure shell commands ... ... or whatever XML tags you want to use using the acutal ... accompish all this in hindsight,as all the commands ...
    (freebsd-questions)
  • Re: Read binary data file
    ... I think its use is quite industry-dependent: I've never seen it used in financial messaging (that's more likely to use SWIFT formats, which are tagged text) but its common in the telecommunications industry. ... Compared with XML its a LOT more compact (tags are one byte, fixed length fields don't have terminators, variable length fields are preceded by a one or two byte length) and it has a number of predefined field types as well as arrays. ...
    (comp.lang.java.programmer)