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 Fri, 6 May 2011 08:50:30 -0500
Organization Service de news de lacave.net
Lines 33
Message-ID <157f745306ab284fab9c037eb8763262@ruby-forum.com> (permalink)
References <8c2481d112417ddf26d13fb9716372c6@ruby-forum.com>
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1304689844 7797 65.111.164.187 (6 May 2011 13:50:44 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Fri, 6 May 2011 13:50:44 +0000 (UTC)
In-Reply-To <8c2481d112417ddf26d13fb9716372c6@ruby-forum.com>
X-Received-From This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway
X-Mail-Count 382746
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <157f745306ab284fab9c037eb8763262@ruby-forum.com>
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!talisker.lacave.net!lacave.net!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:4039

Show key headers only | 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