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 = <<EOF <html> <td class="t4">OZ 0204 F Class <a href="/cgi/get?apt:uMl8TIcSlHI*itn/airports/ICN,itn/air/mp"> ICN</a> to <a href="/cgi/get?apt:uMl8TIcSlHI*itn/airports/LAX,itn/air/mp"> LAX</a></td> <tr> <td class="t4"><font color="white">UNITED</font></td> <td colspan="4" align="right"> <strong>48,164</strong></td> </tr> <tr> <td class="t4"><font color="white">Star Alliance</font></td> <td colspan="4" align="right"> <strong>49,072</strong></td> </tr> </html> 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