class Nokogiri::XML::Node

def ancestors

Get a list of ancestor Node for this Node
##
def ancestors
  parents = []
  this_parent = self.parent
  while this_parent != nil
    parents << this_parent
    this_parent = this_parent.parent
  end
  parents
end