# How to use Builder?

**URL:** <https://www.ruby-forum.com/t/how-to-use-builder/121426>\
**Category:** Ruby\
**Created:** [November 27, 2007, 9:57pm UTC](https://www.ruby-forum.com/t/how-to-use-builder/121426 "2007-11-27T21:57:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [November 27, 2007, 9:57pm UTC](https://www.ruby-forum.com/t/how-to-use-builder/121426/1 "2007-11-27T21:57:30Z")

</div>

Hello. I’m a Ruby newbie, so please bear with me. I have an object  
named Contact that has attributes first\_name, last\_name, address1, etc.  
I want to create an XML file in the following format:

\<?xml version="1.0" encoding="ISO-8859-1"?\> David Smith 123 Main St John Doe 321 First Ave. 

How do I use Builder to create this XML output? Do I need to iterate  
through the Contact attributes and convert into a hash before running  
Builder?

Thanks in advance  
David
