Do we "own" XML namespace?

T

Trans

Hi--

Little bit of debate going on with LibXML, and I'd like to get some
general feed back.

Currently the module namespace used by libxml-ruby is "XML", so we see
code like:

require 'libxml'

XML::Document.new

The question is whether that's fair, since it sort of lays claim to
"XML" as owned by the libxml project. It also means the libraries name
does not correspond to the top module name. So we are considering
instead switching to:

LibXML::Document.new

(though we would leave backward compatibility in for a while). Another
option is:

LibXML::XML::Document.new

since one can always do

include LibXML

to get the same functionality that we have now.

What do others think? What is the best/proper approach here?

Thanks,
T.
 
M

Martin DeMello

(though we would leave backward compatibility in for a while). Another
option is:

LibXML::XML::Document.new

since one can always do

include LibXML

to get the same functionality that we have now.

I like this one - it lets you use the XML namespace without
monopolising it. It also allows someone writing a drop-in replacement
for LibXML to use the same trick and have code switch effortlessly
between the two.

martin
 
C

cfis

Some thoughts...

So I didn't actually do that. Instead, I moved LibXML into a new
LibXML module.

So:

LibXML::Document.new

Then for backwards compatibility in libxml.rb:

module XML
include LibXML
end

I prefer this approach because having to type in LibXML::XML
constantly would be annoying (sure you could do an include, but that
would also be annoying). Since we're making this change, let's make
sure that future usage of the API is a pleasant as possible.
I like this one - it lets you use the XML namespace without
monopolising it. It also allows someone writing a drop-in replacement
for LibXML to use the same trick and have code switch effortlessly
between the two.

Right - and that should still work exactly the same. You'd have to
either uncomment out the libxml require code (true for both
approaches), or remove the XML module and replace it with your own
(also true for both approaches).

Charlie
 
M

matt neuburg

cfis said:
Some thoughts...


So I didn't actually do that. Instead, I moved LibXML into a new
LibXML module.

So:

LibXML::Document.new

Charlie - sounds great, just yell real loud when the gem update
implementing this change comes online... :) Thx! - m.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top