in reply to Parsing XML output from `qstat`
... XML::Smart ...
I wouldn't :)
use XML::LibXML 1.70; ## for load_html/load_xml/location my $qstat = 'qstat.xml'; my $dom = XML::LibXML->new(qw/ recover 2 /)->load_xml( location => $qs +tat ); for my $job ( $dom->findnodes( q{ /job_info/queue_info/Queue-List + } ) ){ print $job->nodePath, "\n"; for my $slot ( $job->findnodes( q{ ./job_list/slots } ) ){ print $slot->nodePath, "\n"; print $slot, "\n"; print $slot->textContent, "\n"; } } __END__ /job_info/queue_info/Queue-List /job_info/queue_info/Queue-List/job_list/slots <slots>1</slots> 1
Re: parsing xml, xpather.pl/htmltreexpather.pl
Also , if you're going to post xml, make sure its well-formed first
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing XML output from `qstat`
by Macslayer (Initiate) on May 05, 2014 at 18:04 UTC | |
by Anonymous Monk on May 05, 2014 at 23:29 UTC | |
by Macslayer (Initiate) on May 06, 2014 at 16:58 UTC |