Uninitialized constant HTMLTree (NameError)

I am working on windows environment, in my code I am using,

require ‘http-access2’

client = HTTPAccess2::Client.new
url=“http://www.elliottbaybook.com/…”
parser = HTMLTree::XMLParser.new(false,false)
parser.feed(client.getContent(url))
xml=parser.document

When I run the code it gives the following error message:

uninitialized constant HTMLTree (NameError)

Vikash Kumar wrote:

I am working on windows environment, in my code I am using,

require ‘http-access2’

client = HTTPAccess2::Client.new
url=“http://www.elliottbaybook.com/…”
parser = HTMLTree::XMLParser.new(false,false)
parser.feed(client.getContent(url))
xml=parser.document

When I run the code it gives the following error message:

uninitialized constant HTMLTree (NameError)

The above error is resolved by adding require ‘html/tree’, but a new
error is coming

uninitialized constant HTMLTree::XMLParser (NameError)

Vikash Kumar wrote:

I am working on windows environment, in my code I am using,

require ‘http-access2’

uninitialized constant HTMLTree (NameError)

You need to require the library with HTMLTree in it.

require ‘html/tree’

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