class Nokogiri::XML::Node

def <=>(other)

different documents cannot be compared.
Compare two Node objects with respect to their Document. Nodes from
##
def <=>(other)
  return unless other.is_a?(Nokogiri::XML::Node)
  return unless document == other.document
  compare(other)
end