Method: OpenNebula::XMLElement#each

Defined in:
lib/opennebula/xml_element.rb

#each(xpath_str, &block) ⇒ Object

Iterates over every Element in the XPath and calls the block with a a XMLElement

block

Block



224
225
226
227
228
229
230
231
232
233
234
# File 'lib/opennebula/xml_element.rb', line 224

def each(xpath_str,&block)
    if NOKOGIRI
        @xml.xpath(xpath_str).each { |pelem|
            block.call XMLElement.new(pelem)
        }
    else
        @xml.elements.each(xpath_str) { |pelem|
            block.call XMLElement.new(pelem)
        }
    end
end