# Any way to convert from hash to XML using builder?

**URL:** <https://www.ruby-forum.com/t/any-way-to-convert-from-hash-to-xml-using-builder/151085>\
**Category:** Ruby\
**Created:** [October 16, 2008, 4:52pm UTC](https://www.ruby-forum.com/t/any-way-to-convert-from-hash-to-xml-using-builder/151085 "2008-10-16T16:52:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehudros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3ec8ea/32.png) [@ehudros](https://www.ruby-forum.com/u/ehudros)\
**Post date:** [October 16, 2008, 4:52pm UTC](https://www.ruby-forum.com/t/any-way-to-convert-from-hash-to-xml-using-builder/151085/1 "2008-10-16T16:52:42Z")

</div>

Hi all,  
Am I missing an obvious way to transform a hash into an XML builder  
object?  
I would like the key to be the tag, and value be the content. attributes  
on a tag are something I don’t really know how to represent - but  
perhaps someone has already thought of that?

Thanks!

---

<div class="post-metadata">

**Author:** ![ehudros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3ec8ea/32.png) [@ehudros](https://www.ruby-forum.com/u/ehudros)\
**Post date:** [October 16, 2008, 5:20pm UTC](https://www.ruby-forum.com/t/any-way-to-convert-from-hash-to-xml-using-builder/151085/2 "2008-10-16T17:20:26Z")

</div>

On Oct 16, 10:52 am, Ehud R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi all,  
> Am I missing an obvious way to transform a hash into an XML builder  
> object?  
> I would like the key to be the tag, and value be the content. attributes  
> on a tag are something I don’t really know how to represent - but  
> perhaps someone has already thought of that?

Yep. [http://xml-simple.rubyforge.org/](http://xml-simple.rubyforge.org/)

– Mark.

---

<div class="post-metadata">

**Author:** ![ehudros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3ec8ea/32.png) [@ehudros](https://www.ruby-forum.com/u/ehudros)\
**Post date:** [October 16, 2008, 5:23pm UTC](https://www.ruby-forum.com/t/any-way-to-convert-from-hash-to-xml-using-builder/151085/3 "2008-10-16T17:23:54Z")

</div>

Mark T. wrote:

> On Oct 16, 10:52ï¿½am, Ehud R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hi all,  
> > Am I missing an obvious way to transform a hash into an XML builder  
> > object?  
> > I would like the key to be the tag, and value be the content. attributes  
> > on a tag are something I don’t really know how to represent - but  
> > perhaps someone has already thought of that?
> 
> Yep. [http://xml-simple.rubyforge.org/](http://xml-simple.rubyforge.org/)
> 
> – Mark.

Thanks, I’ll check it out.
