Define id in xml

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.

On Jan 6, 5:53 am, Brijesh S. [email protected]
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

Thanks for the help

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs