On Aug 24, 2009, at 15:18, Engine Yard wrote:

> Did anyone actually find out a solution to this issue.
>
> I have an ActiveResource object which returns back some xml content  
> (as
> a result of a web service call) with unescaped "& " and this causes  
> the
> same issue.

These two statements are contradictory.  It can't both be XML and have  
unescaped &.

> Wondering if we can customize the method call to
> REXML::Text.initialize() and set raw=>false.
>
> Tried to change the setting in the REXML library that comes with the
> Ruby distribution, but that did not help.
>
> Is there a way to overcome this issue without patching any of Ruby or
> Rails code. I cannot change the content on the web service server.


Use a parser that handles errors:

$ ruby -rubygems -e 'require "nokogiri"; d = Nokogiri::XML "<foo>&<bar/ 
 ></foo>"; p d.errors; p d'
[#<Nokogiri::XML::SyntaxError: xmlParseEntityRef: no name
 >]
<?xml version="1.0"?>
<foo>
   <bar/>
</foo>

$

PS: The name on your email account is odd.