# Uninitialized constant HTMLTree (NameError)

**URL:** <https://www.ruby-forum.com/t/uninitialized-constant-htmltree-nameerror/74308>\
**Category:** Ruby\
**Created:** [November 4, 2006, 1:21pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-htmltree-nameerror/74308 "2006-11-04T13:21:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikashkumar051](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/eb9ed0/32.png) [@vikashkumar051](https://www.ruby-forum.com/u/vikashkumar051)\
**Post date:** [November 4, 2006, 1:21pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-htmltree-nameerror/74308/1 "2006-11-04T13:21:12Z")

</div>

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

require ‘http-access2’

client = HTTPAccess2::Client.new  
url=“[http://www.elliottbaybook.com/](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)

---

<div class="post-metadata">

**Author:** ![vikashkumar051](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/eb9ed0/32.png) [@vikashkumar051](https://www.ruby-forum.com/u/vikashkumar051)\
**Post date:** [November 6, 2006, 12:11pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-htmltree-nameerror/74308/2 "2006-11-06T12:11:19Z")

</div>

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/](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)

---

<div class="post-metadata">

**Author:** ![vikashkumar051](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/eb9ed0/32.png) [@vikashkumar051](https://www.ruby-forum.com/u/vikashkumar051)\
**Post date:** [November 7, 2006, 11:01am UTC](https://www.ruby-forum.com/t/uninitialized-constant-htmltree-nameerror/74308/3 "2006-11-07T11:01:27Z")

</div>

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’
