From: anansi Date: 2007-07-30T03:20:14+09:00 Subject: hpricot and xpath doesn't work like they should ?!? hi, I wanted to write me a little console tv-guide with ruby and hpricot. I installed the firefox xpath checker plugin and went to http://www.klack.de/TvEvening1.php3?HPTFRAME=%2FTvAtEvening.php3 . Then I checked the xpath of these senders fields like ZDF and got: /html/body/table/tbody/tr[2]/td[2]/table/tbody/tr/td/center/form/table/tbody/tr/td[2]/table[2]/tbody/tr/td/table[2]/tbody/tr[3]/th[1] so I tried to parse the website for this and output the hits but I don't get any output. Here's the code: #!/usr/bin/env ruby $Verbose = true require 'hpricot' require 'net/http' url = URI.parse('http://www.klack.de/TvEvening1.php3?HPTFRAME=%2FTvAtEvening.php3') req = Net::HTTP::Get.new(url.path) res = Net::HTTP.start(url.host, url.port) {|http| http.request(req) } tv = Hpricot(res.body) tv.search("/html/body/table/tbody/tr[2]/td[2]/table/tbody/tr/td/center/form/table/tbody/tr/td[2]/table[2]/tbody/tr/td/table[2]/tbody/tr[3]/th[1]").each { |a| puts a} #eof Am I using hpricot in the wrong way? I thought it could handle xpaths? -- greets one must still have chaos in oneself to be able to give birth to a dancing star