I was writing some code where I parse some files with libxml and some with XMLParser. After some effort, I finally realized that there is in incompatibility with the two libraries:
require 'xmlparser' xml_string = "<x><y></y></x>" XMLParser.new.parse(xml_string) -------# -> No errors require 'xmlparser' require 'xml/libxml' xml_string = "<x><y></y></x>" XMLParser.new.parse(xml_string) -------# -> test_sanity.rb:6:in `parse': wrong number of arguments (1 for 0) (ArgumentError) from test_sanity.rb:6 Perhaps the XML::Parser#parse method is clobbering XMLParser's method? If you try to work around this by redefining the parse method in XMLParser: require 'xmlparser' class XMLParser alias_method :diff_name, :parse end require 'xml/libxml' xml_string = "<x><y></y></x>" XMLParser.new.diff_name(xml_string) -------# -> test_sanity.rb:10: [BUG] Segmentation fault ruby 1.8.5 (2006-08-25) [i486-linux] Aborted (core dumped) Since these are both very useful xml parsing libraries, it would be nice if both could be used in the same program... Does anyone know of any work around in the meantime? John Prince UT Austin
_______________________________________________ libxml-devel mailing list libxml-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/libxml-devel