nokogiri

Inserting an element in local HTML file

I am trying to write a Ruby script that would read a local HTML file, and insert some more HTML (basically a string) into it after a certain #divid. I am kinda noob so please don't hesitate to put in some code here. Thanks ...

Nokogiri XML Parsing with Rails

I looked at a lot of tuts but this one seems to have got me where I am controller def index require 'nokogiri' doc = Nokogiri::XML(open("http://sports.yahoo.com/top/rss.xml")) @links = doc.xpath('//item').map do |i| {'title' => i.xpath('title'), 'link' => i.xpath('link'), 'description' => i.xpath('description...

uninitialized constant Tilt::CompileSite::Nokogiri error in sinatra/haml

I have a two line script that works nicely in ruby. I moved it to haml and getting the error NameError at / uninitialized constant Tilt::CompileSite::Nokogiri the haml code: %td - @doc = Nokogiri::XML(File.open(file)) = @doc.xpath("//testsuite").each_with_index {|node,index| "#{index+1}. #{node.attributes["name"]...

[Ruby] How to get HTML after onchange by Nokogiri?

Hello. I`ve trouble on have a HTML document after onchange function by Nokogiri. Of course, Mechanize lib can control that. but, sadly webpage which I want to control is jsp not HTML. Generated HTML showes as belows : form method = "post" name = "mysearchform" <select id = "hall_no" name = "hall_no" onchange = "document.mysearchform....

How to parse html source code with ruby/nokogiri?

I've successfully used ruby (1.8) and nokogiri's css parsing to pull out front facing data from web pages. However I now need to pull out some data from a series of pages where the data is in the "meta" tags in the source code of the page. One of the lines I need is the following: <meta name="geo.position" content="35.667459;139.70625...

HTML returned by Nokogiri is different from actual HTML source code

I have been successfully screen-scraping certain sites but have come across some very odd behavior with Nokogiri today on a certain site. If I view the HTML source code pulled down by Nokogiri with the actual HTML scource code from the site on a certain pages it is truncated. Some pages work just fine and all the data is there and other...