# How is the request XML parsed

**URL:** <https://www.ruby-forum.com/t/how-is-the-request-xml-parsed/153897>\
**Category:** Rails\
**Created:** [November 22, 2008, 3:58pm UTC](https://www.ruby-forum.com/t/how-is-the-request-xml-parsed/153897 "2008-11-22T15:58:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![makire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@makire](https://www.ruby-forum.com/u/makire)\
**Post date:** [November 22, 2008, 3:58pm UTC](https://www.ruby-forum.com/t/how-is-the-request-xml-parsed/153897/1 "2008-11-22T15:58:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![makire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@makire](https://www.ruby-forum.com/u/makire)\
**Post date:** [November 22, 2008, 4:04pm UTC](https://www.ruby-forum.com/t/how-is-the-request-xml-parsed/153897/2 "2008-11-22T16:04:49Z")

</div>

On Nov 22, 2:57 pm, Erik L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

> <https://github.com/rails/rails/blob/v2.2.2/actionpack/lib/action_controller/request.rb#L490>

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

---

<div class="post-metadata">

**Author:** ![makire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@makire](https://www.ruby-forum.com/u/makire)\
**Post date:** [November 24, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/how-is-the-request-xml-parsed/153897/3 "2008-11-24T18:08:42Z")

</div>

Worked like a charm, thanks.

/Erik
