From: "Иван Бишевац" Date: 2012-09-10T19:24:54+09:00 Subject: Re: Parsing through downloaded html --047d7b15ae35ed43c404c9565d56 Content-Type: text/plain; charset=UTF-8 Please read tutorial I've gave you and copy code exactly as I gave you. In my code there is at_xpath("//h1") in yours xpath("//h1"). at_xpath returns first item matching criteria, while xpath returns array of elements. So this error tells you that there is no content method for Array class. 2012/9/10 Sybren Kooistra > 035 > Dir.glob('*.html').each do |document| > 036 > f = File.open(document) > 037?> searchablefile = Nokogiri::HTML(f) > 038?> variabelekoloma = searchablefile.xpath("//h1") > 039?> shee1[row, 0] = variabelekoloma.content > 040?> row += 1 > 041?> end > NoMethodError: undefined method 'content' for > #Nokogiri::XML::NodeSet:0xa501bbc> > from (irb):39: in 'block in irb_binding' > from (irb):35: in 'each' > from (irb):35 > > -- > Posted via http://www.ruby-forum.com/. > > --047d7b15ae35ed43c404c9565d56 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Please read tutorial I've gave you and copy code exactly as I gave you.=
In my code there is at_xpath("//h1")=C2=A0in yours xpath(&qu= ot;//h1"). at_xpath returns first item matching criteria, while xpath = returns array of elements. So this error tells you that there is no content= method for Array class.

2012/9/10 Sybren Kooistra <lists@ru= by-forum.com>
035 > Dir.glob('*.html').each do |document|
036 > f =3D File.open(document)
037?> searchablefile =3D Nokogiri::HTML(f)
038?> variabelekoloma =3D searchablefile.xpath("//h1")
039?> shee1[row, 0] =3D variabelekoloma.content
040?> row +=3D 1
041?> end
NoMethodError: undefined method 'content' for
#Nokogiri::XML::NodeSet:0xa501bbc>
from (irb):39: in 'block in irb_binding'
from (irb):35: in 'each'
from (irb):35

--047d7b15ae35ed43c404c9565d56--