At 3:11 PM -0600 3/16/09, Charlie Savage wrote:
Stephen,

And where is the Hash#to_xml method defined?

It's part of what an activesupport xml_mini backend does.

Take a look in the rails source code here:

  activesupport/lib/active_support/xml_mini

Which you can see here:

http://github.com/rails/rails/tree/18eb80ccc7e932f9a6c00462ceaeea648631b120/activesupport/lib/active_support/xml_mini

line 40 in libxml.rb is the start of the Hash.from_xml method implementation for the libxml backend.

Here's the test I'm working on:

http://github.com/stepheneb/rails_hash_from_xml/blob/823a8b6b4c2bad04a27e9131082d816e8c19990e/test/test_rexml_equality.rb

libxml is failing two test right now:

[rails_hash_from_xml (master)]$ ruby -I$RAILS_SOURCE/activesupport/lib test/test_rexml_equality.rb
Testing xml_mini backends: Nokogiri LibXML
Loaded suite test/test_rexml_equality
Started
....F.............F.
Finished in 0.165816 seconds.

  1) Failure:
test_children_with_non_adjacent_comparing_LibXML_to_rexml(TestRexmlEquality) [test/test_rexml_equality.rb:151]:
<{"root"=>
  {"__content__"=>"\n    good\n    \n    morning\n  ",
"products"=>{"__content__"=>"\n hello everyone\n "}}}> expected but was
<{"root"=>
  {"__content__"=>"\n    morning\n  ",
   "products"=>{"__content__"=>"\n      hello everyone\n    "}}}>.

  2) Failure:
test_two_lists_in_a_collection_comparing_LibXML_to_rexml(TestRexmlEquality) [test/test_rexml_equality.rb:151]:
<{"collection"=>
  {"list"=>
    {"definition"=>
      [{"word"=>"Evaporation",
        "definition"=>
"Evaporation is the process of changing from a liquid to a gas, for example, water changing from a liquid into water vapor."},
       {"word"=>"Condensation",
        "definition"=>
"Condensation is the process of changing from a gas to a liquid, for example, water changing from water vapor into a liquid."}],
     "object"=>[{"id"=>"123"}, {"id"=>"456"}]}}}> expected but was
<{"collection"=>
  {"list"=>
    {"object"=>
      [{"id"=>"123"},
       {"id"=>"456"},
       {"word"=>"Evaporation",
        "definition"=>
"Evaporation is the process of changing from a liquid to a gas, for example, water changing from a liquid into water vapor."},
       {"word"=>"Condensation",
        "definition"=>
"Condensation is the process of changing from a gas to a liquid, for example, water changing from water vapor into a liquid."}]}}}>.

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to