From: Thomas Sondergaard Date: 2005-11-10T18:22:13+09:00 Subject: REXML problem I'm trying to use a ruby and rexml to manipulate some Qt linguist xml files, but I've run into a problem with certain XPath expressions. The script below fails with the following error /usr/lib/ruby/1.8/rexml/xpath_parser.rb:718:in `compare': undefined method `<' for ... :REXML::Element (NoMethodError) from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:626:in `equality_relational_compare' from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:626:in `equality_relational_compare' from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:387:in `expr' from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:383:in `expr' from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:282:in `expr' from /usr/lib/ruby/1.8/rexml/encoding.rb:47:in `each_with_index' from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:276:in `expr' from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:125:in `match' from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:56:in `parse' from /usr/lib/ruby/1.8/rexml/xpath.rb:30:in `first' from /usr/lib/ruby/1.8/rexml/element.rb:812:in `[]' from ./tst.rb:33 I get a match if I remove the newline between and
in the xpath expression and in the xml source. What's the problem? How do I work around it? my ruby version: ruby 1.8.3 (2005-09-21) [i386-linux] require 'rexml/document' doc_xml = < DisplaySetItemWidget <table> </table> EOF doc = REXML::Document.new doc_xml ctx_elem = doc.elements["/TS/context[name='DisplaySetItemWidget']"] expr = <