Define id in xml


#1

Hi

I like to generate xml like

abc abc

Here I want to display id in each user tag. So How can I do that?

Thanks
Brijesh S.


#2

On Jan 6, 5:53 am, Brijesh S. removed_email_address@domain.invalid
wrote:

Here I want to display id in each user tag. So How can I do that?

require ‘builder’

builder = Builder::XmlMarkup.new(:indent => 2)

xml = builder.users do |users|
(1…2).each do |user_id|
users.user(:id => user_id) do |u|
u.email(“foo”)
end
end
end

puts xml

#=>

foo foo

#3

Thanks for the help