Xml/libxml "first" method doesn't work

Hello,

I am having a problem with the xml/libxml Ruby Gem

doc = XML::Document.file(‘myfile.xml’)
mynodes = doc.find(’[xpath statement here]’)
mynodes.length
=> 20
mynodes.first
=> NoMethodError: undefined method `first’ for
#XML::Node::Set:0x31039c

The Doc does mention a “first” method for XML::Node::Set. Is this a bug?

Thanks!
Ingo

On Sun, 2006-05-07 at 04:40 +0900, Ingo W. wrote:

#XML::Node::Set:0x31039c

The Doc does mention a “first” method for XML::Node::Set. Is this a bug?

This method was introduced in the recent 0.3.8 release, so you may need
to upgrade from an older version.

require ‘xml/libxml’
XML::Parser::VERSION

=> “0.3.8”

doc = XML::Document.file(‘safs/testlog.xml’)
set = doc.find(’//log_message’)

=> <log_message type=“start testcase”> […]

set.length

=> 3

set.first

=> <log_message type=“start testcase”> […]