from_xml(xml) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
April 3, 2012
1 thank

Looks like this method has trouble with attributes:

ex:

require 'rubygems'
require 'bundler'
require 'active_support/core_ext'
require 'pp'

xml  = 
  '<test id="appears">
    <comment id="doesnt appear">
      it worked
    </comment>
    <comment>
     see!
    </comment>
    <comment />
  </test>'

hash = Hash.from_xml(xml)

pp hash

#=>{"test"=>{"id"=>"appears", "comment"=>["it worked", "see!", nil]}}

# Notice how the id attribute on the first comment element doesn't appear.