Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Fetch field values from API output

by choroba (Chancellor)
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?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2016-02-12 02:13 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (386 votes), past polls