From: Gary Wright Date: 2007-03-18T09:00:54+09:00 Subject: Re: mixin classes (continuning from the last post) It looks like REXML already provides the two iterators you need to satisfy TSort. Try this: require 'rexml/document' require 'tsort' class REXML::Element include TSort def tsort_each_node(&block) each_recursive(&block) end def tsort_each_child(node, &block) node.each_child(&block) if node.respond_to?(:each_child) end end doc = REXML::Document.new < Text, text, text EOS p doc.tsort Gary Wright