class Nokogiri::XML::Node

def traverse(&block)

Yields self and all children to +block+ recursively.
###
def traverse(&block)
  children.each { |j| j.traverse(&block) }
  yield(self)
end