From: TRANS Date: 2007-03-25T06:09:07+09:00 Subject: Re: interaction bug between rexml and yaml On 3/23/07, David Vanderson wrote: > Hello, > > I've been having some trouble converting rexml documents to yaml and > back. See the following test case: > #!/usr/bin/env ruby > require 'yaml' > require 'rexml/document' > d = REXML::Document.new 'Hello' > puts YAML::load(d.to_yaml) > > When I run it I get this error: > NoMethodError: undefined method `each_value' for "my_val":String > from /usr/lib/ruby/1.8/rexml/element.rb:1029:in `each_attribute' > from /usr/lib/ruby/1.8/rexml/element.rb:1025:in `each_attribute' > from /usr/lib/ruby/1.8/rexml/element.rb:684:in `write' > from /usr/lib/ruby/1.8/rexml/document.rb:165:in `write' > from /usr/lib/ruby/1.8/rexml/document.rb:163:in `write' > from /usr/lib/ruby/1.8/rexml/node.rb:23:in `to_s' > from (irb):5 > > I believe it has something to do with the REXML::Attributes class > extending Hash, so YAML::load produces just a Hash, without Attribute > objects inside. > > This is with: > ruby 1.8.4 (2005-12-24) [i386-linux] > > Can anyone else reproduce this? Get the same. Same version of ruby, though. T.