# XML Element attributes

**URL:** <https://www.ruby-forum.com/t/xml-element-attributes/110292>\
**Category:** Rails\
**Created:** [July 25, 2007, 12:03am UTC](https://www.ruby-forum.com/t/xml-element-attributes/110292 "2007-07-25T00:03:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maestro777](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@maestro777](https://www.ruby-forum.com/u/maestro777)\
**Post date:** [July 25, 2007, 12:03am UTC](https://www.ruby-forum.com/t/xml-element-attributes/110292/1 "2007-07-25T00:03:25Z")

</div>

Hi.

I’m trying to create an XML file of the following schema:

 Some description text here Some description text here 

And I only managed to accomplish the following schema:

 July 12 2007 July 14 2007 

Some description text here

 July 20 2007 July 30 2007 

Some description text here

using the following codes:

xml.instruct! :xml, :version=\>“1.0”  
xml.data{  
for vac in @vacations  
xml.event do  
xml.start(vac.start\_date.strftime"%B %d %Y" )  
xml.end (vac.end\_date.strftime"%B %d %Y" )  
xml.p(vac.description)  
end  
end  
}

Can someone help point out how I may accomplish that? Having the  
element in the format of  
Some text here

Thank you in advance for your help.

---

<div class="post-metadata">

**Author:** ![maestro777](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@maestro777](https://www.ruby-forum.com/u/maestro777)\
**Post date:** [July 25, 2007, 12:29am UTC](https://www.ruby-forum.com/t/xml-element-attributes/110292/2 "2007-07-25T00:29:33Z")

</div>

Hi,

> I’m trying to create an XML file of the following schema:
> 
> Some description text here

you can pass the text of the tag as the first parameter and any  
attributes as a hash.

xml.event ‘Some description text’, :start=\>‘July 12 2007’, :end=\>‘July  
14 2007’

regards,

javier ramirez

---

<div class="post-metadata">

**Author:** ![maestro777](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@maestro777](https://www.ruby-forum.com/u/maestro777)\
**Post date:** [July 25, 2007, 12:56am UTC](https://www.ruby-forum.com/t/xml-element-attributes/110292/3 "2007-07-25T00:56:44Z")

</div>

It works great for me.  
Thank you SO much Javier for your help.
