Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Perl : How to retrieve from xml when xml file having same attribute multiple time

by poj (Abbot)
on Oct 14, 2015 at 16:24 UTC ( #1144886=note: print w/replies, xml ) Need Help??


in reply to Re^2: Perl : How to retrieve from xml when xml file having same attribute multiple time
in thread Perl : How to retrieve from xml when xml file having same attribute multiple time

for my $cdr (@{$VAR1->{'cdr'}}){ my $network = $cdr->{'networkInfo'}; if ($network->{'requestType'} eq '1001'){ my $payer = $cdr->{'payerInfo'}; my $priced = $cdr->{'pricedInfo'}; print $network->{'sessionId'}."\n"; print $payer->{'baseWalletBalance'}."\n"; print $priced->{'totalCostPrice'}."\n"; } }
poj
  • Comment on Re^3: Perl : How to retrieve from xml when xml file having same attribute multiple time
  • Download Code

Replies are listed 'Best First'.
Re^4: Perl : How to retrieve from xml when xml file having same attribute multiple time
by bhushanQA (Sexton) on Oct 15, 2015 at 07:03 UTC
    Thanks Pijo for help..!! It was working perfect if we take Array reference and multiple attributes present in the same file. But this is failing only one attribute is present in the file.. it says not an array reference.Below is my xml data dumper o/p.
    $VAR1 = { 'cdr' => { 'networkInfo' => { 'extPayer' => '13000', 'ggsnAddress' => '172.26.33.44', 'instanceId' => '0', 'imei' => '0', 'networkUsageIdentifier' => '172.2 +6.33.44', 'ReleaseCause' => '00144', 'spendControlId' => '0', 'defaultPayer' => '13000', 'gprsLocationInfo' => '0130120857' +, 'sessionId' => '151014195900000010 +1', 'errorCode' => '0', 'requestType' => '1001', 'timeZone' => '', 'ccRequestType' => '3', 'defaultExtPayer' => '13000', 'sgsnAddress' => '172.26.33.44', 'gprsLBC' => '0', 'gprsApn' => 'tecnotree.com', 'connectionType' => '0', 'gprsAttributes' => '', 'eventDateTime' => '20151014195959 +', 'imsiMccMnc' => '724110000000069', 'sequenceNumber' => '0', 'unitType' => '2', 'holidayCode' => '0', 'serviceIdentifier' => '0', 'ratingGroup' => '1029', 'pdpType' => '0', 'pdpAddress' => '172.26.33.44', 'sgsnMccMnc' => '', 'specialLocationClassId' => '0', 'eventType' => '0', 'payerType' => '0', 'connectionId' => '005029740902190 +', 'payer' => '13000', 'cgAddress' => '', 'redirectionCode' => '0', 'callReferenceNumber' => '11499269 +2', 'ggsnMccMnc' => '', 'mvnoId' => '3', 'originatingNetworkId' => '1081', 'chargingId' => '114992692', 'actionDateTime' => '2015101419595 +9', 'tariffToken' => '0', 'callTerminationCause' => '1', 'exponent' => '-6' }, 'payerInfo' => { 'newPayerStatus' => '2', 'noOfPayerValidity' => '0', 'prevPayerStatus' => '2', 'walletDetails' => { 'walletId' => '1' +, 'prevWalletBalanc +e' => '9856000000000', 'prevExpiryDate' +=> '20151202', 'expiryFlag' => ' +0', 'newWalletBalance +' => '9854000000000', 'newExpiryDate' = +> '20151202' }, 'noOfWalletsUsed' => '1', 'baseWalletBalance' => '985400000000 +0' }, 'pricedInfo' => { 'totalUsedUnits' => '2000', 'totalCostPrice' => '2000000000', 'bucket' => { 'rateId' => '1347', 'discountPercentage' => + '0', 'startUnits' => '1', 'exchangeRate' => '1000 +000', 'taxFormulaId' => '1002 +', 'componentId' => '0', 'taxWalletId' => '1', 'currencyRateId' => '1' +, 'discountArticleId' => +'1001', 'walletId' => '1', 'salePrice' => '2000000 +000', 'discountAmount' => '0' +, 'TaxDetail' => { 'Tax' => + { + 'amount' => '0', + 'count' => '1', + 'article' => '1009' } }, 'usedUnits' => '2000', 'endUnits' => '2000', 'taxApplied' => '0', 'debitedValue' => '2000 +000000', 'costPrice' => '2000000 +000', 'dimensionId' => '0', 'serviceKey' => '0', 'chargeArticleId' => '1 +', 'tariffId' => '1422' }, 'taxingOptionUsed' => '0', 'totalTax' => '0', 'totalSalePrice' => '2000000000', 'chargeSummary' => { 'dimensionSummar +y' => { + 'dimensionId' => '0', + 'componentSummary' => { + 'totalSalePrice' => '2000000000', + 'totalCostPrice' => '2000000000', + 'componentId' => '0', + 'totalDiscountAmount' => '0', + 'bucketsUsed' => '1' + } + } }, 'bucketsUsed' => '1', 'totalDiscountAmount' => '0' } } };

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1144886]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2021-07-28 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?