# Nokogiri DocumentFragment code blowing up

**URL:** <https://www.ruby-forum.com/t/nokogiri-documentfragment-code-blowing-up/197560>\
**Category:** Ruby\
**Created:** [October 16, 2010, 1:14am UTC](https://www.ruby-forum.com/t/nokogiri-documentfragment-code-blowing-up/197560 "2010-10-16T01:14:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [October 16, 2010, 1:14am UTC](https://www.ruby-forum.com/t/nokogiri-documentfragment-code-blowing-up/197560/1 "2010-10-16T01:14:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rustysam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4da419/32.png) [@rustysam](https://www.ruby-forum.com/u/rustysam)\
**Post date:** [October 18, 2010, 6:33pm UTC](https://www.ruby-forum.com/t/nokogiri-documentfragment-code-blowing-up/197560/2 "2010-10-18T18:33:56Z")

</div>

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
