From: Gavin Kistner Date: 2005-09-04T08:40:05+09:00 Subject: Re: How to get REXML to return items in order?? --Apple-Mail-2--692775499 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Sep 3, 2005, at 3:16 PM, ted wrote: > I'm new to Ruby and can't figure out why REXML isn't returning the > elements > in the order they appear in the document. Here's my code and the > document. I confirm the problem. Looks like a bug. If I remove some of the anchors, it works. (Off-topic - no need to use empty named anchors in your page - just use IDs on existing elements instead.) Sliver:~/Desktop] gkistner$ cat tmp.rb code = <
1st Title
2nd Title
ENDHTML require 'rexml/document' xml = REXML::Document.new( code ); xml.elements.each( "//span[@class='c5']" ) do |element| puts element end [Sliver:~/Desktop] gkistner$ ruby -v tmp.rb ruby 1.8.2 (2004-12-25) [powerpc-darwin7.7.2] 3rd Title 1st Title 2nd Title --Apple-Mail-2--692775499--
3rd Title