How to extract text from a node but not from its children
I'm trying to parse this fragment with nokogiri from a page(so named a var) that contains
...
<dd>
<a href="http://www.bo.es">Access </a>
- 19/07/11
</dd>
...
page.at("dd").text
shows me the whole text, not only dd's but also it's descendants text too. I mean
"Access - 19/07/11"
开发者_如何学运维
How can I extract only "- 19/07/11"
?
(this is only an example)
Try page.xpath("//dd/text()").text
精彩评论