in reply to Parsing XML output from `qstat`
G'day Ben,
Welcome to the monastery.
Short answer: I'm unable to reproduce your problem.
Longer answer:
I set up $qstat as a here-doc. I changed '... ?revision=1.11"' to 'revision="1.11"' and removed the other elision. Check that your original data (prior to replacing parts with '...') was actually valid XML.
Other than that, I used your code as written. The output was a lone "1" character as was expected from "<slots>1</slots>".
You actually don't need all those '->'s. I tried with the following code and got the same result.
for ($xml->{job_info}{queue_info}{'Queue-List'}('@')) { print $_->{job_list}{slots}; }
I'm not a user of XML::Smart. I had to install this module, so I used the latest 1.79 version. Check that you're also using this or upgrade. Also check for any problems with your OS or Perl version (I'm using 5.18.1 on darwin-thread-multi-2level).
Here's the actual code and data I used for my tests (in the spoiler):
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing XML output from `qstat`
by Macslayer (Initiate) on May 05, 2014 at 18:05 UTC |