Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Fetch field values from API output

by choroba (Canon)
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 perusing the Monastery: (18)
As of 2015-07-29 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls