Include link anchor text in xpath text extraction?
I have a series of <p>
tags, an example:
<p>normal text<a href="#">link ancho开发者_如何学Cr text</a>more normal text</p>
the XPath //p/text()
doesn't include "link anchor text", how can I include it?
//p/text()
asks for all text nodes that are direct children of p
elements. You could ask for //p//text()
, but I'm guessing you are actually looking for string(//p)
.
精彩评论