Nokogiri find text in paragraphs
Posted
by astropanic
on Stack Overflow
See other posts from Stack Overflow
or by astropanic
Published on 2010-05-08T10:02:32Z
Indexed on
2010/05/08
10:08 UTC
Read the original article
Hit count: 227
I want to replace the inner_text in all paragraphs in my XHTML document.
I know I can get all text with Nokogiri like this
doc.xpath("//text()")
But I want only operate on text in paragraphs, how I can select all text in paragraphs without affecting eventually existent anchor texts in links ?
#For example : <p>some text <a href="/">This should not be changed</a> another one</a>
© Stack Overflow or respective owner