Powerfull XML Deserialization of ActiveRecord object

Hi,

i m trying to deserialize XML that came from a model class.
To serialize i use "to_xml" method like :

Foo.find(:all).to_xml(:include=>[:foo2])

Now i m trying to deserialize it.
I tried to use "Hash.from_xml" but it doesn't take care of the
associations.

I found someone who wrote his own "from_xml" method that take care of
associations.
here is the code : http://riftor.g615.co.uk/index.php?action=view&id=20

The problem occur with this piece of code :

root.elements.inject([]) do |instances, element|
          instances.push(self.from_xml(element))
end

Here is the error :

NoMethodError: private method `gsub!' called for []:Array
  from /Applications/Locomotive2/Bundles/
rmagickRailsMar2007_i386.locobundle/framework/lib/ruby/1.8/rexml/
parsers/xpathparser.rb:20:in `parse'
  from /Applications/Locomotive2/Bundles/
rmagickRailsMar2007_i386.locobundle/framework/lib/ruby/1.8/rexml/
xpath_parser.rb:57:in `parse'
  from /Applications/Locomotive2/Bundles/
rmagickRailsMar2007_i386.locobundle/framework/lib/ruby/1.8/rexml/
xpath.rb:53:in `each'
  from /Applications/Locomotive2/Bundles/
rmagickRailsMar2007_i386.locobundle/framework/lib/ruby/1.8/rexml/
element.rb:947:in `inject'
  from ./script/../config/../config/environment.rb:152:in `from_xml'
  from (irb):3

To try to use it put his code at the bottom of environment.rb

If any one could help me,
and help others after me with this kind of needs..

Thanks :slight_smile:

Am i the only one who want to deserialize xml :slight_smile: ??

really, no one ?

goch...