Skip to content

Instantly share code, notes, and snippets.

@pezholio
Last active December 18, 2015 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pezholio/5780309 to your computer and use it in GitHub Desktop.
Save pezholio/5780309 to your computer and use it in GitHub Desktop.
I'm going slightly mad
require 'nokogiri'
require 'open-uri'
uri = "http://data.gov.uk/dataset/water-framework-directive-lake-waterbodies-wfs"
doc = Nokogiri::HTML(open(uri))
doc.search('link[rel=alternate]').each do |e|
if e[:type] == "application/rdf+xml"
puts "rdf should be #{e[:href]}"
rdf = e[:href]
end
end
# rdf should be http://data.gov.uk/dataset/water-framework-directive-lake-waterbodies-wfs.rdf
# > rdf
# NameError: undefined local variable or method `rdf' for main:Object
rdf = "foo"
# > rdf
# => "foo"
# WAT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment