Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: XML data extraction

by snehit.ar (Beadle)
on Oct 11, 2017 at 11:43 UTC ( [id://1201154]=note: print w/replies, xml ) Need Help??


in reply to Re: XML data extraction
in thread XML data extraction

Sample code i Have share but it need updation base on given 2 condition for required output..Thank you for help.
#!/usr/bin/perl use strict; use warnings; use XML::XPath; use XML::LibXML::NodeList; use Data::Dumper; my @records; my $bamxml = 'BAMOpenApi.xml'; my $bamxp = XML::XPath->new(filename => $bamxml); my $bamxpath = $bamxp->findnodes('//nodes/node/children/node/chil +dren/node'); my $pattern = shift; my $matches = XML::LibXML::NodeList->new; foreach my $bamnode ($bamxpath->get_nodelist) { my $name = $bamxp->find('./@name',$bamnode)->string_value; my $citype = $bamxp->find('./@ciType',$bamnode)->string_value; my $status = $bamxp->find('./dimension/@status',$bamnode)->str +ing_value; my $time = $bamxp->find("./dimension/body/entry",$bamnode)->st +ring_value; s/^\s+|\s+$//g for $name,$citype,$status,$time; push @records, { name => $name, citype => $citype, status => $status, Time => $time }; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-03-28 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found