I have a problem matching a single-tag XML to paths like '/something',
illustrated by the following shell session quote. Who is at fault here -
myself or rexml?
[alex@dhcp-89-2 test-report]$ ruby -v
ruby 1.9.0 (2004-07-31) [i686-linux]
[alex@dhcp-89-2 test-report]$ irb -v
irb 0.9(02/07/03)
[alex@dhcp-89-2 test-report]$ irb
irb(main):001:0>
irb(main):011:0> xml = REXML::Element.new('element attr="aaa"')
=> <element attr="aaa"/>
irb(main):012:0> REXML::XPath.match(xml, '/*')
NoMethodError: undefined method `node_type' for nil:NilClass
from /usr/local/lib/ruby/1.9/rexml/xpath_parser.rb:124:in
`internal_parse'
from /usr/local/lib/ruby/1.9/rexml/xpath_parser.rb:123:in `each'
from /usr/local/lib/ruby/1.9/rexml/xpath_parser.rb:123:in
`internal_parse'
from /usr/local/lib/ruby/1.9/rexml/xpath_parser.rb:49:in `match'
from /usr/local/lib/ruby/1.9/rexml/xpath_parser.rb:34:in `parse'
from /usr/local/lib/ruby/1.9/rexml/xpath.rb:59:in `match'
from (irb):12
from /usr/local/lib/ruby/1.9/rexml/text.rb:250
Best regards,
Alexey Verkhovsky