in reply to parsing various xml responses

Ok, it is not working again, this is in the same routine, the first one works, but now this one does not work... Here is the code:
$_xmlCode = q~<?xml version="1.0" encoding="UTF-8"?><PayoneerToken><To +ken>https://sandbox.payoneer.com/partners/lp.aspx?token=akn2w3knsnk32 +3lnknasdin4falkngnaskjncik32l12</Token></PayoneerToken> ~; $ob = new XML::Bare( text => "$_xmlCode" ); $root = $ob->parse(); $_redirectUrl = $root->{PayoneerToken}{Token}{Value}; # Print to browser to see if it is working... print "Content-type: text/html\n\n"; print qq~ \$_redirectUrl = '$_redirectUrl';<br> <br> <b>\$_xmlCode='$_xmlCode'</b>;<br>~;
And it does not work, it prints this in the browser:
## Browser output not perl code: $_redirectUrl = ''; $_xmlCode='<?xml version="1.0" encoding="UTF-8"?><PayoneerToken><Token +>https://sandbox.payoneer.com/partners/lp.aspx?token=akn2w3knsnk323ln +knasdin4falkngnaskjncik32l12</Token></PayoneerToken>';
Any idea now, why that would not work? I've tried changing the variables names and everything.

I installed XML::Trivial as pajout suggested in his thread. I used the cpan module to install it with all the dependencies but I had to force it to get it to install, and it returned make success, however, when just calling the use on it, I get errors on the server, so I am not going to even try using that one.

I would really appreciate any advice on what you think the problem could be now.

Thank you again.
Richard

Replies are listed 'Best First'.
Re^2: parsing various xml responses
by ikegami (Patriarch) on Dec 17, 2009 at 03:54 UTC
    When in doubt, use Data::Dumper to dump the tree. There's no key named Value, but there is one named value.
      Ok, I did the dump, and here is the result:
      Dump of $root2 { PayoneerToken => { Token => {} }, _i => -416395696, _pos => 0, _z => + 0, value => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><PayoneerToke +n><Token>https://sandbox.payoneer.com/partners/lp.aspx?token=akn2w3kn +snk323lnknasdin4falkngnaskjncik32l12</Token></PayoneerToken>", }

      Any clues as to why it is broken?

      thanks again,
      Richard

        No it isn't. The code you posted does not produce that.

Re^2: parsing various xml responses
by Anonymous Monk on Dec 17, 2009 at 03:55 UTC
    Just wanted to say, I tried it first with: $root->{PayoneerToken}{Token}{value};
    and it did not work so I tried it the way I show it above:
    $root->{PayoneerToken}{Token}{Value}; neither one are working for me.

    Thanks,
    Richard