mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #3782: support multiple xpath values
xpath.rb will return multiple values if the xpath starts with "%m%"
This commit is contained in:
parent
586686f6dd
commit
77a72e9d33
@ -58,8 +58,14 @@ end
|
||||
xml = REXML::Document.new(tmp).root
|
||||
|
||||
ARGV.each do |xpath|
|
||||
element = xml.elements[xpath.dup]
|
||||
values << element.text.to_s if !element.nil?
|
||||
if xpath.match(/^%m%/)
|
||||
xpath = xpath[3..-1]
|
||||
ar = xml.elements.to_a(xpath).map {|t| t.text }
|
||||
values << ar.join(' ')
|
||||
else
|
||||
element = xml.elements[xpath.dup]
|
||||
values << element.text.to_s if !element.nil?
|
||||
end
|
||||
values << "\0"
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user