I found that was easier to use the Java library XMLUnit than any native solution
require 'java'
require '/usr/share/java/xmlunit.jar'
java_import org.custommonkey.xmlunit.Diff
puts Diff.new("<a></a>", "<a/>").similar
puts Diff.new("<a/>", "<b/>").similar
Of course, this means you have to use JRuby instead of CRuby, but that wasn't a significant obstacle in my case.