Skip to content

Instantly share code, notes, and snippets.

@andrewsardone
Created June 16, 2009 20:59
Show Gist options
  • Save andrewsardone/130895 to your computer and use it in GitHub Desktop.
Save andrewsardone/130895 to your computer and use it in GitHub Desktop.
# text_children_of_element(REXML::XPath.first(node, query))
def text_children_of_element(e, s=[])
if e.has_elements?
s << ""
e.each_element { |el| text_value_of_element(el,s) }
elsif e.has_text?
s << e.text.chomp
end
s.join(" ")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment