-#require 'rubygems'
-#gem 'libxml-ruby', '>= 0.8.3'
-#require 'libxml'
-
-# Is this really needed?
-LibXML::XML::Parser.register_error_handler do |message|
- raise message
+# This is required otherwise libxml writes out memory errors to
+# the standard output and exits uncleanly
+LibXML::XML::Error.set_handler do |message|
+ fail message