I have some XHTML (but really any XML will do) like this:
<h1>
Hello<span class='punctuation'>,</span>
<span class='noun'>World<span class='punctuation'>!</span>
</h1>
How do I get the full content of the <h1/>
as a String in Ruby? As in:
assert_equal "Hello, World!", h1_node.some_method_that_aggregates_all_content
Do any of the XML frameworks (Nokogiri, libxml-ruby, &c.) have this sort of thing built-in? If not, I feel like a Y-Combinator might the right tool for the job, but I can't quite figure out what it would look like.