From: Axel Etzold Date: 2009-09-25T06:32:37+09:00 Subject: Re: Ordering XML Attributes with Hpricot? Dear Lance, > > Since the attributes are kept in a hash there's no order to them, so > they appear in seemingly random order, but it's the same random order > consistently. > > Any ideas how to do that? > a Hash can be sorted to give an Array with Hash#sort : http://ruby-doc.org/core/classes/Hash.html#M002865 > And is there a way to say "after two attributes, make a new line". So I > can print out xml that can be edited by humans like code. You can then iterate through the Array with Array#each_with_index, eg. my_array.each_with_index{|x,i| > > Thanks, > Lance > -- > Posted via http://www.ruby-forum.com/. -- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser