[s3-dev] Don't overwrite XmlSimple#xml_in

Jeffrey Hardy packagethief at gmail.com
Mon Jun 23 08:15:44 EDT 2008

Hi Marcel --

I think our choice of parsing library is an implementation detail.

It would be different if we were using FasterXmlSimple as a drop-in  
replacement, relying on XmlSimple as the common interface. It's a  
credit to the designer that we have Parsing.parser, which explicitly  
uses either FasterXmlSimple or XmlSimple.

So we don't need to rely on FasterXmlSimple to modify XmlSimple for us.

Since we're bundling the library, we're in the position to remove the  
drop-in replacement feature of FasterXmlSimple and avoid burdening the  

I agree that effort should go into making FasterXmlSimple a true drop- 
in replacement. But fortunately for us, that's the one feature we  
don't need.


On 23-Jun-08, at 2:58 AM, Marcel Molina Jr. wrote:

> Sorry you struggled with that Jeff. It is a bit sneaky to do that  
> without so much as even warning to stderr that FasterXmlSimple is  
> being used.
> When you say, "We probably shouldn't be in the practice of changing  
> another library unexpectedly, especially if we don't need to." I  
> agree with you but you might reconsider "if we don't need to" after  
> just using REXML. It makes some fairly basic operations consume a  
> lot of resources and go quite slow.
> FasterXmlSimple was written in only a couple days as a quick attempt  
> to fix the unpleasant REXML experience. Ideally in this case I think  
> it would be go to try to put the work into make FXS more compatible  
> with XmlSimple but I can understand if you aren't interested in  
> doing that.
> I'm cool with the user having to explicitly configure the use of  
> FasterXmlSimple rather than it just magically happening.
> On Jun 23, 2008, at 11:06 AM, Jeffrey Hardy wrote:
>> I've forked aws/s3 on github and removed the bundled  
>> FasterXmlSimple's unfortunate overwriting of XmlSimple#xml_in.
>> The reason FasterXmlSimple's overwriting is unfortunate is that its  
>> version isn't 100% compatible:
>> $ irb -rubygems
>> >> require 'xmlsimple'
>> >> xml = '<response success="true"><items></items></response>'
>> >> XmlSimple.xml_in(xml)
>> => {"items"=>[{}], "success"=>"true"}
>> >> require 'aws/s3'
>> >> XmlSimple.xml_in(xml)
>> => {"response"=>{"items"=>{}, "success"=>"true"}}
>> This can cause a lot of head scratching when you're using XmlSimple  
>> and wondering why it's not working like you'd expect. We probably  
>> shouldn't be in the practice of changing another library  
>> unexpectedly, especially if we don't need to.
>> Since we're bundling the library and not relying on gems to load  
>> it, modifying it in place seems appropriate.
>> Feel free to pull these changes if anyone agrees.
>> http://github.com/jhardy/aws-s3/tree/master
>> /Jeff
>> _______________________________________________
>> amazon-s3-dev mailing list
>> amazon-s3-dev at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/amazon-s3-dev
> marcel
> --
> Marcel Molina Jr.
> marcel at vernix.org

More information about the amazon-s3-dev mailing list