[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to use Builder?

David Cheng

11/27/2007 8:58:00 PM

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"?>
<contacts>
<contact>
<first_name>David</first_name>
<last_name>Smith</last_name>
<address1>123 Main St</address1>
</contact>
<contact>
<first_name>John</first_name>
<last_name>Doe</last_name>
<address1>321 First Ave.</address1>
</contact>
</contacts>

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
--
Posted via http://www.ruby-....