From: Dan Kohn Date: 2005-09-16T04:46:34+09:00 Subject: Re: How to get REXML to return items in order?? Daz, there's a bug in the CVS version of REXML. The following code produces the error below, but works perfectly with the default 1.8.2 REXML (i.e., when I comment out the first line). >ruby rexmlbug.rb C:/Dan/dev/rexml/xpath_parser.rb:157:in `expr': undefined method `delete_if' for nil:NilClass (NoMethodError) from C:/Dan/dev/rexml/xpath_parser.rb:481:in `d_o_s' from C:/Dan/dev/rexml/xpath_parser.rb:478:in `each_index' from C:/Dan/dev/rexml/xpath_parser.rb:478:in `d_o_s' from C:/Dan/dev/rexml/xpath_parser.rb:469:in `descendant_or_self' from C:/Dan/dev/rexml/xpath_parser.rb:314:in `expr' from C:/Dan/dev/rexml/xpath_parser.rb:125:in `match' from C:/Dan/dev/rexml/xpath_parser.rb:56:in `parse' from C:/Dan/dev/rexml/xpath.rb:53:in `each' from rexmlbug.rb:28 >Exit code: 1 $:.unshift('C:/Dan/dev') # for rexml fixes require "rexml/document" include REXML string = < OZ 0204 F Class ICN to LAX UNITED 48,164 Star Alliance 49,072 EOF doc = Document.new string.gsub!(/\s+| /," ") array = Array.new XPath.each( doc, "//td[@colspan='4']/preceding-sibling::td/child::*") { |cell| array << cell.texts.to_s } puts array