Module: HappyMapper::AnonymousMapper

Included in:
HappyMapper
Defined in:
lib/happymapper/anonymous_mapper.rb

Instance Method Summary collapse

Instance Method Details

#parse(xml_content) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/happymapper/anonymous_mapper.rb', line 4

def parse(xml_content)

  # TODO: this should be able to handle all the types of functionality that parse is able
  #   to handle which includes the text, xml document, node, fragment, etc.
  xml = Nokogiri::XML(xml_content)

  happymapper_class = create_happymapper_class_with_element(xml.root)

  # With all the elements and attributes defined on the class it is time
  # for the class to actually use the normal HappyMapper powers to parse
  # the content. At this point this code is utilizing all of the existing
  # code implemented for parsing.
  happymapper_class.parse(xml_content, :single => true)

end