Nokogiri DocumentFragment code blowing up

I was attempting to experiment with Nokogiri::HTML::DocumentFragment and
using the following code

require ‘rubygems’
require ‘rest-open-uri’
require ‘nokogiri’

doc1 = Nokogiri::HTML(open(“c:/RUBY_OUT.TXT”));
doc2 = doc1.xpath("//table[@class=‘result’][2]");
doc3 =

c:/RUBY_OUT.TXT contains a web page

doc2 = doc1.xpath("//table[@class=‘result’][2]");
extracts a single table from the web page

doc3 =
blows IRB up - multiple lines flash and Interactive Ruby window closes.

If I subsitute “abc” for doc2 as argument it then executes and flags an
illegal data type.

Any suggestions as to how I can determine what is happening.


Just to close this off

With my code the nokogiri::HTML::DocumentFragment is throwing an error:
no strip method

The error is an uncaught exception so it blows up the test code.

Appears to be some problems with document fragments that are being
looked at by the developers.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs