Class: OpenNebula::XMLPool

Inherits:
XMLElement show all
Defined in:
opennebula/xml_element.rb,
opennebula/xml_pool.rb

Overview

The XMLUtilsPool module provides an abstraction of the underlying XML parser engine. It provides XML-related methods for the Pools

Direct Known Subclasses

Pool

Instance Method Summary (collapse)

Methods inherited from XMLElement

#[], #add_element, #attr, build_xml, #delete_element, #each, #each_xpath, #element_xml, #has_elements?, #initialize_xml, #name, #retrieve_elements, #template_like_str, #template_str, #template_xml, #text, #to_hash, #to_xml

Constructor Details

- (XMLPool) initialize(xml = nil)

A new instance of XMLPool



406
407
408
# File 'opennebula/xml_element.rb', line 406

def initialize(xml=nil)
    super(xml)
end

Instance Method Details

- (Object) each_element(block)

Executes the given block for each element of the Pool

block

Block



412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'opennebula/xml_element.rb', line 412

def each_element(block)
    if NOKOGIRI
        @xml.xpath(
            "#{@element_name}").each {|pelem|
            block.call self.factory(pelem)
        }
    else
        @xml.elements.each(
            "#{@element_name}") {|pelem|
            block.call self.factory(pelem)
        }
    end
end