Niklas Cathor wrote in post #961490:
> Can't reproduce your problem. Try this:
>
>   require 'rubygems'
>   require 'nokogiri'
>   # make sure the file contains sth.
>   File.open('test.html', 'w') {|f|
>     f.write("<html><body><h1>Foo</h1></body></html>") }
>
>   f = File.open('test.html')
>   data = Nokogiri::HTML(f)
>   puts data
>   p data
>
> ----- OUTPUT ------
>
>   <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>   "http://www.w3.org/TR/REC-html40/loose.dtd">
>   <html><body><h1>Foo</h1></body></html>
>   #<Nokogiri::HTML::Document:0x3ff244a4fb70 name="document"
>   children=[#<Nokogiri::XML::DTD:0x3ff244ad5e14 name="html">,
>   #<Nokogiri::XML::Element:0x3ff244adf5b8 name="html"
>   children=[#<Nokogiri::XML::Element:0x3ff244b50e0c name="body"
>   children=[#<Nokogiri::XML::Element:0x3ff244b50b28 name="h1"
>   children=[#<Nokogiri::XML::Text:0x3ff244b508a8 "Foo">]>]>]>]>




Hi,

First thanks to all for helping me in my problem.

I got the solution finally,

I tried

f = open("test.html").read
data = Nokogiri::HTML(f)
puts data
instead of

f = FIle.open("test.html")
data = Nokogiri::HTML(f)
puts data

and i get html data.

so basically i don't use File class.

Thanks,
Priyank Shah

-- 
Posted via http://www.ruby-forum.com/.