# Libxml-ruby

**URL:** <https://rubytalk.org/t/libxml-ruby/36316>\
**Category:** ruby-talk\
**Created:** [21 March 2007 00:57 UTC](https://rubytalk.org/t/libxml-ruby/36316 "2007-03-21T00:57:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohammad\_Khan2](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Mohammad\_Khan2](https://rubytalk.org/u/Mohammad_Khan2)\
**Post date:** [21 March 2007 00:57 UTC](https://rubytalk.org/t/libxml-ruby/36316/1 "2007-03-21T00:57:23Z")

</div>

[beeplove@vpn ruby-agi-1.1.1]$ irb  
irb(main):001:0\> require 'rubygems'  
=\> true  
irb(main):002:0\> require\_gem 'libxml-ruby'  
=\> true  
irb(main):003:0\> doc = XML::Document.new()  
NameError: uninitialized constant XML  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):3  
irb(main):004:0\>

'gem list' returns  
\*\*\* LOCAL GEMS \*\*\*

libxml-ruby (0.3.8.4)  
&nbsp;&nbsp;&nbsp;&nbsp;LibXML2 bindings for Ruby

Would anybody plese tell me where I am doing wrong?

Thanks,  
Mohammad

---

<div class="post-metadata">

**Author:** ![7rans](https://avatars.discourse-cdn.com/v4/letter/7/a8b319/32.png) [@7rans](https://rubytalk.org/u/7rans)\
**Post date:** [21 March 2007 01:44 UTC](https://rubytalk.org/t/libxml-ruby/36316/2 "2007-03-21T01:44:01Z")

</div>

require 'xml/libxml' \<-- loads the lib

T.

> **···**
>
> On Mar 20, 8:57 pm, "Mohammad Khan" \<khan.moham...@acm.org\> wrote:
> 
> > [beeplove@vpn ruby-agi-1.1.1]$ irb  
> > irb(main):001:0\> require 'rubygems'  
> > =\> true  
> > irb(main):002:0\> require\_gem 'libxml-ruby' \<-- just initializes the library  
> > =\> true

---

<div class="post-metadata">

**Author:** ![Mohammad\_Khan2](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Mohammad\_Khan2](https://rubytalk.org/u/Mohammad_Khan2)\
**Post date:** [21 March 2007 01:49 UTC](https://rubytalk.org/t/libxml-ruby/36316/3 "2007-03-21T01:49:07Z")

</div>

[beeplove@vpn ~]$ irb  
irb(main):001:0\> require 'rubygems'  
=\> true  
irb(main):002:0\> require\_gem 'libxml-ruby'  
=\> true  
irb(main):003:0\> require 'xml/libxml'  
xml/libxml  
LoadError: no such file to load -- xml/libxml  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/site\_ruby/1.8/rubygems/custom\_require.rb:22:in  
`require\_\_'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/site\_ruby/1.8/rubygems/custom\_require.rb:22:in  
`require'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):3  
irb(main):004:0\>

> **···**
>
> On 3/20/07, Trans \<transfire@gmail.com\> wrote:
> 
> > On Mar 20, 8:57 pm, "Mohammad Khan" \<khan.moham...@acm.org\> wrote:  
> > \> [beeplove@vpn ruby-agi-1.1.1]$ irb  
> > \> irb(main):001:0\> require 'rubygems'  
> > \> =\> true  
> > \> irb(main):002:0\> require\_gem 'libxml-ruby' \<-- just initializes the  
> > library  
> > \> =\> true
> > 
> > require 'xml/libxml' \<-- loads the lib
> > 
> > T.
> 
> --  
> "Proper planning prevents poor performance."  
> - Anonymous

---

<div class="post-metadata">

**Author:** ![7rans](https://avatars.discourse-cdn.com/v4/letter/7/a8b319/32.png) [@7rans](https://rubytalk.org/u/7rans)\
**Post date:** [21 March 2007 02:17 UTC](https://rubytalk.org/t/libxml-ruby/36316/4 "2007-03-21T02:17:14Z")

</div>

Check your installation of libxml. Look in the gems installation dir  
for the libxml-ruby package and see if the xml/libxml.rb file is  
there. It's working fine on my machine and I just reinstalled from  
scratch to be sure.

You might want to update your version of RubyGems too.

T.

> **···**
>
> On Mar 20, 9:49 pm, "Mohammad Khan" \<khan.moham...@acm.org\> wrote:
> 
> > [beeplove@vpn ~]$ irb  
> > irb(main):001:0\> require 'rubygems'  
> > =\> true  
> > irb(main):002:0\> require\_gem 'libxml-ruby'  
> > =\> true  
> > irb(main):003:0\> require 'xml/libxml'  
> > xml/libxml  
> > LoadError: no such file to load -- xml/libxml  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/site\_ruby/1.8/rubygems/custom\_require.rb:22:in  
> > `require\_\_'  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from /usr/lib/site\_ruby/1.8/rubygems/custom\_require.rb:22:in  
> > `require'  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):3  
> > irb(main):004:0\>

---

<div class="post-metadata">

**Author:** ![Mohammad\_Khan2](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Mohammad\_Khan2](https://rubytalk.org/u/Mohammad_Khan2)\
**Post date:** [21 March 2007 12:57 UTC](https://rubytalk.org/t/libxml-ruby/36316/5 "2007-03-21T12:57:22Z")

</div>

I need, require 'xml/libxml\_so' or 'libxml\_so' after '"gem 'libxml-ruby'

Looks like gemspec of libxml-ruby doesn't have 'autorequire' parameter.

Thanks,  
Mohammad

> **···**
>
> On 3/20/07, Trans \<transfire@gmail.com\> wrote:
> 
> > On Mar 20, 9:49 pm, "Mohammad Khan" \<khan.moham...@acm.org\> wrote:  
> > \> [beeplove@vpn ~]$ irb  
> > \> irb(main):001:0\> require 'rubygems'  
> > \> =\> true  
> > \> irb(main):002:0\> require\_gem 'libxml-ruby'  
> > \> =\> true  
> > \> irb(main):003:0\> require 'xml/libxml'  
> > \> xml/libxml  
> > \> LoadError: no such file to load -- xml/libxml  
> > \> from /usr/lib/site\_ruby/1.8/rubygems/custom\_require.rb:22:in  
> > \> `require\_\_'  
> > \> from /usr/lib/site\_ruby/1.8/rubygems/custom\_require.rb:22:in  
> > \> `require'  
> > \> from (irb):3  
> > \> irb(main):004:0\>
> > 
> > Check your installation of libxml. Look in the gems installation dir  
> > for the libxml-ruby package and see if the xml/libxml.rb file is  
> > there. It's working fine on my machine and I just reinstalled from  
> > scratch to be sure.
> > 
> > You might want to update your version of RubyGems too.
> > 
> > T.
> 
> --  
> "Proper planning prevents poor performance."  
> - Anonymous

---

<div class="post-metadata">

**Author:** ![7rans](https://avatars.discourse-cdn.com/v4/letter/7/a8b319/32.png) [@7rans](https://rubytalk.org/u/7rans)\
**Post date:** [21 March 2007 13:01 UTC](https://rubytalk.org/t/libxml-ruby/36316/6 "2007-03-21T13:01:45Z")

</div>

autorequire has been deprecated. So it's doing the right thing there.  
But I'm surprised you have to load 'libxml\_so'. that seems like a bug  
to me.

T.

> **···**
>
> On Mar 21, 8:57 am, "Mohammad Khan" \<khan.moham...@acm.org\> wrote:
> 
> > I need, require 'xml/libxml\_so' or 'libxml\_so' after '"gem 'libxml-ruby'
> > 
> > Looks like gemspec of libxml-ruby doesn't have 'autorequire' parameter.
