From: Engine Yard Date: 2009-08-25T07:18:40+09:00 Subject: Re: REXML: parsing a string with unescaped ampersand entitie 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. 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. Thanks, Maruthy. Frank Reiff wrote: >> I think I might be on to something there.. > > Ok, it was in fact precisely that. When I do a : > > cgi.params.to_s > > I get the correctly formatted XML message, but when there is an & in the > message > > cgi.params.to_s > > this produces an erratic output. > > This is of course because: > > The method params() returns a hash of all parameters in the request as > name/value-list pairs, where the value-list is an Array of one or more > values. The CGI object itself also behaves as a hash of parameter names > to values, but only returns a single value (as a String) for each > parameter name. > > The output is therefore a fluke that's solely based on the fact that > there is only one parameter. > > Now my FINAL question to all the Ruby gurus: > > * How do I get the POST-ed message body without any clever splitting > into key/value pairs!? -- Posted via http://www.ruby-forum.com/.