Class: GenesisRuby::Parsers::Xml

Inherits:
Base
  • Object
show all
Defined in:
lib/genesis_ruby/parsers/xml.rb

Overview

XML Document Parser

Instance Attribute Summary

Attributes inherited from Base

#root_node_skipped, #structure

Instance Method Summary collapse

Methods inherited from Base

#initialize, #skip_root_node

Constructor Details

This class inherits a constructor from GenesisRuby::Parsers::Base

Instance Method Details

#parse_document(document) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/genesis_ruby/parsers/xml.rb', line 11

def parse_document(document)
  load_document(document)

  @structure = if root_node_skipped
                 collect_nodes(@document.root)
               else
                 { @document.root.name.to_sym => collect_attributes(@document.root).merge(
                   collect_nodes(@document.root)
                 ) }
               end
end