Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #4039

Re: newbie to using builder(for xml markup)

From Brad Symons <snomys@hotmail.com>
Newsgroups comp.lang.ruby
Subject Re: newbie to using builder(for xml markup)
Date 2011-05-06 08:50 -0500
Organization Service de news de lacave.net
Message-ID <157f745306ab284fab9c037eb8763262@ruby-forum.com> (permalink)
References <8c2481d112417ddf26d13fb9716372c6@ruby-forum.com>

Show all headers | View raw


Answered BY MYSELF!!

There appears to be a conflict with using the :id value, if you have a 
tag attribute named as this, for some reason it inserts it at the very 
end.

So using:

ids.each do |num|
  xml.programme(:id => num, :alpha => alphas.fetch(ids.index(num)))
end

will print:
<programme alpha="xxx" id="1"/>
<programme alpha="yyy" id="2"/>
<programme alpha="zzz" id="3"/>

but changing, like so:

ids.each do |num|
  xml.programme(:num => num, :alpha => alphas.fetch(ids.index(num)))
end

will print:
<programme num="1" alpha="xxx"/>
<programme num="2" alpha="yyy"/>
<programme num="3" alpha="zzz"/>

SO BE CAREFUL WHEN USING "id"

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

newbie to using builder(xml) Brad Symons <snomys@hotmail.com> - 2011-05-06 07:28 -0500
  Re: newbie to using builder(for xml markup) Brad Symons <snomys@hotmail.com> - 2011-05-06 08:50 -0500
    Re: newbie to using builder(for xml markup) Jeremy Bopp <jeremy@bopp.net> - 2011-05-06 10:06 -0500
  Re: newbie to using builder(for xml markup) 7stud -- <bbxx789_05ss@yahoo.com> - 2011-05-06 12:33 -0500

csiph-web