On Wed, Sep 10, 2008 at 3:03 AM,  <[EMAIL PROTECTED]> wrote:
> The README is misleading as the code samples say to use "require 'libxml'" 
> which does not work when you do not include LibXML, too.
>
> I found in the comments of libxml.rb to use require 'xml' instead, see below
>
> # DEPRECATED: Use require 'xml' instead!
> #
> # include LibXML
>
> Please correct this, because the README is the first thing people look for 
> code samples

I see that someon already did some work on this, but I the README a
bit more to give some of the rational between use cases. The first
part of ==Usage now reads:

== USAGE
For in-depth information about using libxml-ruby please refer
to its online Rdoc documentation.

All libxml classes are in the LibXML::XML module. The most
expedient way to use libxml is to require 'xml'.  This will mixin
the LibXML module into the global namespace, allowing you to
write code like this:

  require 'xml'
  document = XML::Document.new

However, when creating an application or library you plan to
redistribute, it is best to not add the LibXML module to the global
namespace, in which case you can either write your code like this:

  require 'libxml'
  document = LibXML::XML::Document.new

or, more conveniently, utilize a proper namespace for you own work
and include LibXML into it. For example:

  require 'libxml'

  mdoule MyApplication
    include LibXML

    class MyClass
      def some_method
        document = XML::Document.new
      end
    end
  end

For simplicity's sake we will use require 'xml in the basic examples
shown below.

T.
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to