But since you went ahead with swapping XML => LibXML, that probably
best anyway. I wonder about one thing though, is backward
compatibility best preserved with:
 XML = LibXML
or as you have it:
 module XML
   include LibXML
 end

Use an environment variable at require time and the module assigns.

# XX untested
if ['0','false','no','off',false,nil,'hell god damn "no!" me harder'].include? (ENV['RUBY_LIBXML_SHORT_PATH'].nil? ? true : ENV['RUBY_LIBXML_SHORT_PATH'].downcase])
  # Only LibXML class
else
  XML = LibXML
end

Then users can set the env variable and goto town however they want.

FYI, I moved to XSLT to LibXSLT to be consistent. Although when I started using it, I found it to be a bit ugly. Take a look:

 # Create a new XSL Transform
 stylesheet_doc = LibXML::Document.file('files/fuzface.xsl')
 stylesheet     = LibXSLT::Stylesheet.new(stylesheet_doc)

 # Transform a xml document
 xml_doc = LibXML::Document.file('files/fuzface.xml')
 result = stylesheet.apply(xml_doc)


Notice how hard it becomes to distinguish the namespaces (LibXML and LibXSLT). Compare:

 # Create a new XSL Transform
 stylesheet_doc = XML::Document.file('files/fuzface.xsl')
 stylesheet     = XSLT::Stylesheet.new(stylesheet_doc)

Thoughts?


Use of XML was actually a conscious choice on my part. Ditch the puritanical or egalitarian thoughts. Odds of two XML parsing libraries loaded into the same instance is rare. I imagined there would be little to no contention for the XML namespace because everyone would've treated it as holy. Bah! A "User" identifier is holy, but XML is not (one is application, the other is library). I think the above 'LibXML'-ification of the namespace is appropriate, however, but focus on making the library easy to use, hence XML vs LibXML.

Don't step on other people's dicks intentionally, but it's okay for the library to be assertive and to match its ambitions. Tip-toeing around 'what if' is an endless rabbit hole. We'll adapt and find a solution if there is a problem at some point in the future. Cool?

-sc

--
Sean Chittenden
[EMAIL PROTECTED]



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

Reply via email to