On Wed, Oct 27, 2010 at 2:57 AM, Corey Watts <cwatts / westmont.edu> wrote:
> I still haven't figured this out.     
> a different way...
>
> What is the preferred method of extracting the href attribute from a
> link?  § > @href attribute.      >
> Is there a different way of extracting this attribute, without using
> .search and an xml path?  §   
> too...

With this and a local version of the page I was able to get the info you want:

#!/bin/env ruby19

require 'nokogiri'

raw = File.read("restaurants.html", mode: "r:UTF-8")
puts raw.encoding
# raw.force_encoding 'UTF-8'
doc = Nokogiri.parse raw

doc.xpath('//div[@class="listing_content"]').each do |listing|
  puts '----------------------------------------'
  # p listing.to_s[0...10]+"..."
  puts listing
  puts '----------------------------------------'
  # p listing.xpath('.//a//text()').map(&:to_s)
  listing.xpath('.//a[@href and contains(text(),"Website")]/@href').each doa|
    p a.value
  end
  puts
end

Cheers

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/