nokogiri DocumentFragment code blowing up

D

Don Norcott

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 = Nokogiri::HTML::DocumentFragment.new(doc2)

c:/RUBY_OUT.TXT contains a web page

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

doc3 = Nokogiri::HTML::DocumentFragment.new(doc2)
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.


Don
 
D

Don Norcott

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.

Don
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top