Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #4036
| From | Brad Symons <snomys@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | newbie to using builder(xml) |
| Date | 2011-05-06 07:28 -0500 |
| Organization | Service de news de lacave.net |
| Message-ID | <8c2481d112417ddf26d13fb9716372c6@ruby-forum.com> (permalink) |
Hi, I am just trying to understand how builder sorts the content of an xml node, because no matter how I arrange the options, they appears sorted differently in the irb. ids = ["1","2","3"] alphas = ["xxx","yyy","zzz"] xml = Builder::XmlMarkup.new( :target => $stdout, :indent => 2 ) xml.instruct! :xml, :version => "1.1", :encoding => "US-ASCII" ids.each do |num| xml.programme(:alpha => alphas.fetch(ids.index(num)), :id => num) end This prints: <programme alpha="xxx" id="1"/> <programme alpha="yyy" id="2"/> <programme alpha="zzz" id="3"/> But if I re-arrange the positioning to: xml.programme(:id => num, :alpha => alphas.fetch(ids.index(num))) It still produces: <programme alpha="xxx" id="1"/> <programme alpha="yyy" id="2"/> <programme alpha="zzz" id="3"/> NO CHANGE!!! Also, is there an easy way to map the values of the arrays together, than using the fetch method? THANKS IN ADVANCE!! -- Posted via http://www.ruby-forum.com/.
Back to comp.lang.ruby | Previous | Next — Next in thread | Find similar | Unroll 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