Class Core::Providers::Multiverse::Parsers::NodesSectionParser
In: core/serviceproviders/multiverse/parsers/nodes_section_parser.rb
Parent: Object

Parser for the nodes section of the XML document.

Methods

check   parse  

Included Modules

Interfaces::Parsers::SectionParser

Public Instance methods

Check that the required nodes tags are present in the document.

[Source]

# File core/serviceproviders/multiverse/parsers/nodes_section_parser.rb, line 68
          def check(document) 
            ; # no requirements for the <nodes> section
          end

Parse the nodes section of the document and return an array containing all the information

[Source]

# File core/serviceproviders/multiverse/parsers/nodes_section_parser.rb, line 74
          def parse(document, universe)        
            universe.nodes = []
            nodesroot = document.root.elements['nodes']
            nodesroot.elements.each do |n|
              # TODO: validate node
              node = { 
                :name => n.attributes['name'], 
                :type => n.attributes['type'].to_i,
                :properties => {}
              }
              if n.elements['properties'] && !n.elements['properties'].size.zero?
                n.elements['properties'].elements.each do |prop|
                  property = parse_property(prop.attributes)
                  property.populator = find_populator_for(property, universe.meta[:name], universe.path)
                  if not property.nil?
                    node[:properties][property.key] = property
                  end
                end
              end
              universe.nodes << node
            end
          end

[Validate]