From: "Иван Бишевац" Date: 2012-09-10T18:51:30+09:00 Subject: Re: Parsing through downloaded html --f46d042e0255c254f404c955e60c Content-Type: text/plain; charset=UTF-8 Copy here full error. 2012/9/10 Sybren Kooistra > I get the error 'block in irb_binding' 'in 'each'' ? > > code = > > require 'Nokogiri' > require 'Spreadsheet' > Spreadsheet.client_encoding = "UTF-8" > book = Speadsheet::Workbook.new > sheet1 = book.create_worksheet > row = 0 > Dir.chdir("anattempt") > Dir.glob('*.html').each do |document| #apparently something goes wrong > here > f = file.open(document) > searchablefile = Nokogiri::HTML(f) > > variabelekoloma = searchablefle.xpath("//h1") > sheet1[row,0] = variabelekoloma.content > row += 1 > end > book.write 'htmltoexcel.xls' > > # Plus, how could i save boolean? (for example: if xpath has > content/returns text, then 'yes'). > > -- > Posted via http://www.ruby-forum.com/. > > --f46d042e0255c254f404c955e60c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Copy here full error.

2012/9/10 Sybren Ko= oistra <lists@ruby-forum.com>
I get the error 'block in irb_binding' 'in 'each'' = ?

code =3D

require 'Nokogiri'
require 'Spreadsheet'
Spreadsheet.client_encoding =3D "UTF-8"
book =3D Speadsheet::Workbook.new
sheet1 =3D book.create_worksheet
row =3D 0
Dir.chdir("anattempt")
Dir.glob('*.html').each do |document| #apparently something g= oes wrong
here
f =3D file.open(document)
searchablefile =3D Nokogiri::HTML(f)

variabelekoloma =3D searchablefle.xpath("//h1")
sheet1[row,0] =3D variabelekoloma.content
row +=3D 1
end
book.write 'htmltoexcel.xls'

# Plus, how could i save boolean? (for example: =C2=A0if xpath has content/returns text, then 'yes').

--f46d042e0255c254f404c955e60c--