For those interested, I was passing in an instance of Text rather  
than a string.  Oops.  Calling to_s solved the problem.

Christian

On Feb 12, 2006, at 1:14 PM, Christian Cantrell wrote:

> I'm trying to use the unnormalize method of the Text class in the  
> REXML module to un-escape some XML, but I'm getting this error:
>
> /usr/local/lib/ruby/1.8/rexml/text.rb:304:in `unnormalize': private  
> method `gsub!' called for #<REXML::Text:0x10aeb80> (NoMethodError)
>
> The code for the unnormalize method looks like this:
>
> def Text::unnormalize( string, doctype=nil, filter=nil, illegal=nil )
>   rv = string.clone
>   rv.gsub!( /\r\n?/, "\n" )
> ...
>
> Any ideas as to why Ruby thinks gsub! is private, and why I can't  
> call the method?
>
> Thanks,
> Christian
>