Forum: Ruby on Rails How is the request XML parsed

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4a7a142aab3340704a9ae1abe74a3263?d=identicon&s=25 Erik Lindblad (Guest)
on 2008-11-22 15:58
(Received via mailing list)
Hi all

When one sends for example a POST request with an XML body Rails
parses this into a hash with a corresponding structure. How is this
conversion done and where? Which XML library is used? Any pointers on
where in the Rails source this is done would be helpful.

Kindest regards

Erik
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-22 16:04
(Received via mailing list)
On Nov 22, 2:57 pm, Erik Lindblad <e...@aldm.se> wrote:
> Hi all
>
> When one sends for example a POST request with an XML body Rails
> parses this into a hash with a corresponding structure. How is this
> conversion done and where? Which XML library is used? Any pointers on
> where in the Rails source this is done would be helpful.
>

See
http://github.com/rails/rails/tree/v2.2.2/actionpa...

You can override what happens with

ActionController::Base.param_parsers[Mime::Type.lookup
('some_mime_type')] = Proc.new do |data|
  #turn data into a hash of attributes
end

Fred
4a7a142aab3340704a9ae1abe74a3263?d=identicon&s=25 Erik Lindblad (Guest)
on 2008-11-24 18:08
(Received via mailing list)
Worked like a charm, thanks.

/Erik
This topic is locked and can not be replied to.