Forum: JRuby pls test and comment on rails patch to use jdom backend for Hash.to_xml

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
6f608b6766f79343062a2aa3985933dc?d=identicon&s=25 Stephen Bannasch (Guest)
on 2009-04-24 22:49
(Received via mailing list)
Rails normally uses REXML to implement this class method
activesupport adds to Hash:


This is used when Rails needs to process data in XML form such as
when ActiveResource consumes an external resource.

Rails 2.3 added support for using LibXML and Nokogiri as backends for
from_xml if these gems are installed which can speed up the process.

I've created a patch for rails that adds support for using jdom as a
backend if rails is running under jruby.

I'm sure my implementation could be sped up considerably but as it is
now it's about 3x faster than rexml when processing a large (1.8MB)
xml document.

Normally Hash.from_xml will just use REXML.

You can set an alternate backend like this:

   ActiveSupport::XmlMini.with_backend('JDOM') {
     Hash.from_xml({:a => "foo",:b => "bar"}.to_xml)

Within the block the from_xml method will use the JDOM backend
instead of REXML.

I'd love some other eye's on the patch.  Unless it gets some '+1's
from other JRuby developers it won't get applied.

The patch is attached here:

It applies cleanly to 2.3.2 and to 2-3-stable.

I haven't tested it yet on master (which is heading off to rails3-land).

This patch relates to more general work I'm doing benchmarking the
alternate from_xml backends and generalizing the tests.



To unsubscribe from this list, please visit:
F7e175b37a4c69709ef75c28792f2b32?d=identicon&s=25 Ikai Lan (Guest)
on 2009-04-25 00:37
(Received via mailing list)
Wow, this would be AWESOME as a GitHub gem for general JRuby work! Hide
that ugly Java-ness under a sweet Ruby wrapper.


On 4/24/09 1:20 PM, "Stephen Bannasch" <>

> The patch is attached here:
> alternate from_xml backends and generalizing the tests.
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:

To unsubscribe from this list, please visit:
This topic is locked and can not be replied to.