我正在使用NOKOGIRI浏览网页.我熟悉XPath,但我无法弄清楚为什么我的XPath无法获取特定的行.请参阅ruby代码.
我使用FireBug XML来验证我的XPath,所以我99%确定我的XPath是正确的.
require 'nokogiri'
require 'open-uri'
@searchURL = 'http://www.umn.edu/lookup?UID=smit4562'
@xpath = '//html/body/p/table/tbody/tr/td[2]/table/tbody/tr[2]'
doc = Nokogiri::HTML(open(@searchURL))
puts 'row should be = Email Address: smit4562@umn.edu'
puts '=> ' + doc.xpath(@xpath).to_s
puts 'is row emppty?'
puts '=> ' + doc.xpath(@xpath).empty?().to_s
Run Code Online (Sandbox Code Playgroud) 我正在启动Rails 3.2应用程序.我正在使用Git作为我的存储库,并想知道我应该保留哪些文件的版本,以及我应该从命令操作中动态生成哪些文件.
特别:
config/routes.rb
db/migrate/*
db/schema.rb
lib/assets/*
lib/tasks/*
script/rails
test/performance/browsing_test.rb
tmp/*
vendor/assests/*
vendor/plugins/*
Run Code Online (Sandbox Code Playgroud)
还有其他我应该知道的吗?