# Xml with Rails?

**URL:** <https://www.ruby-forum.com/t/xml-with-rails/88553>\
**Category:** Rails\
**Created:** [March 12, 2007, 4:44pm UTC](https://www.ruby-forum.com/t/xml-with-rails/88553 "2007-03-12T16:44:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 12, 2007, 4:44pm UTC](https://www.ruby-forum.com/t/xml-with-rails/88553/1 "2007-03-12T16:44:07Z")

</div>

Hi,

I wolud like to know which “plugin” or library is the best for rails?

Thanks you very much!!!

Sayoyo

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 12, 2007, 5:08pm UTC](https://www.ruby-forum.com/t/xml-with-rails/88553/2 "2007-03-12T17:08:04Z")

</div>

On Mar 12, 2007, at 11:44 AM, sayoyo wrote:

> I wolud like to know which “plugin” or library is the best for rails?

That’s going to depend at least partially on what it is you want to  
do with rails. Rails will generate XML from ActiveRecord objects (and  
accept some XML as input) by default. Check out:

[Buckblog: Web services, Rails-style](http://weblog.jamisbuck.org/2006/3/27/web-services-rails-style)  
[Input formats and content types in Rails 1.2 – James Stewart](http://jystewart.net/process/2007/02/input-formats-and-content-types-)  
in-rails-12/

Rails itself makes use of Builder, so for anything more complex you’d  
be best off checking that out first.

[http://builder.rubyforge.org/](http://builder.rubyforge.org/)

James.

–  
James S.  
Play: [http://james.anthropiccollective.org](http://james.anthropiccollective.org)  
Work: [Processing Greenbelt 2009 – James Stewart](http://jystewart.net/process/)

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 12, 2007, 6:41pm UTC](https://www.ruby-forum.com/t/xml-with-rails/88553/3 "2007-03-12T18:41:22Z")

</div>

Hi, James

First, thanks you very much for the information!!! Thanks, what I want  
to do is simple read/write and search in an XML file, like xpath, I  
wonder if there are already some predefined classes or modules that can  
perform the task?

Sayoyo

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 13, 2007, 5:38am UTC](https://www.ruby-forum.com/t/xml-with-rails/88553/4 "2007-03-13T05:38:11Z")

</div>

Rexml comes with stock Ruby and will do most everything you need:

[http://www.germane-software.com/software/rexml/](http://www.germane-software.com/software/rexml/)

b

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 12, 2007, 7:10pm UTC](https://www.ruby-forum.com/t/xml-with-rails/88553/5 "2007-03-12T19:10:24Z")

</div>

> to do is simple read/write and search in an XML file, like xpath, I  
> wonder if there are already some predefined classes or modules that can  
> perform the task?

if you need Xpath, then you can try with REXML. It supports  
DOM,Xpath,SAX and StaX… for an easier XML parser (a XML to ruby  
objects mapper) you can try simpleXml. There are more libraries out  
there, but these two come bundled with any RoR installation, so there is  
a decent documentation and they work out-of-the-box

regards,

javier ramirez

## –

Estamos de estreno… si necesitas llevar el control de tus gastos  
visita [http://www.gastosgem.com](http://www.gastosgem.com) !!Es gratis!!
