Forum: Ruby [libxml] NoMethodError for XML::Node::Set

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
522c66f4c4bc46cc4df007018e2505e6?d=identicon&s=25 Vaucher Bastien (bastien-vaucher)
on 2007-02-21 10:36
I just began using libxml and I wanted to find the "body" tag in a xhtml
file, so i tried this :

doc = XML::Document.file(@file)
root = doc.root
nodeset = @root.find("body")
node = nodeset.first

but when I execute the code I get this error message :

NoMethodError: undefined method `first' for #<XML::Node::Set:0x330c624>

Does someone know where this could come from ? And how to make sure it's
installed correctly ?
To install it I used darwinport and when I look at the installed
librairies, I see that :
libiconv @1.11_4+darwin_8 (active)
libxml @1.8.17_0 (active)
libxml2 @2.6.27_0 (active)
rb-libxml2 @0.3.6_0 (active)
rb-rubygems @0.9.1_0 (active)
ruby @1.8.5-p12_0 (active)
zlib @1.2.3_0 (active)

Thanks for your help
This topic is locked and can not be replied to.