How to use Builder?

D

David Cheng

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top