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

Re: Fetch field values from API output

by choroba (Abbot)
on Dec 14, 2012 at 06:36 UTC ( #1008781=note: print w/ replies, xml ) Need Help??


in reply to Fetch field values from API output

A solution using XML::XSH2, a wrapper around XML::LibXML.

#!/usr/bin/perl use warnings; use strict; use feature qw(say); use XML::XSH2; @XML::XSH2::Map::accum_ids = (269, 270, 1962); xsh << '__XSH__'; open 1008484.xml ; for my $id in { @accum_ids } { cd /envelope/body/outputGetUsageSummary/usgSumm/usageAccum[@ac +cumId=$id] ; my $attrs = (@inclUnits | @inclUnitsUsed | @shared) ; perl { push @results, $attrs } ; } __XSH__ for my $result (@XML::XSH2::Map::results) { say join ' ', map $_->value, @$result; }
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Fetch field values from API output
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-07-29 11:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (216 votes), past polls