src = '<paragraph>And bla foo <note>not important</note> bar baz</paragraph>'
doc = Nokogiri::XML(src)
puts doc.xpath('paragraph').first.content
The return code returns:
"And bla foo not important bar baz"
I am looking for a way to get content without nested elements. The above example is just an XML example, but in this example I want this to be the result:
"And bla foo bar baz"
source
share