开发者

XPath: Get node below another node

I'm new to XPath, and I need to get the table node after the following:

<p><b>Some unique string</b></p>

<center><table>
<tr>
<th>.....

I have been tryin开发者_开发问答g things such as:

"following-sibling::.//p//b[.='Some unique string']"
".//p//b[.='Some unique string']/following:://table"

So far I've managed to get rather stuck and confused, would greatly appreciate a pointer in the right direction. So thank you in advance :)

(If it makes a difference, I'm using the lxml.html module in Python 2.6)


This XPath 1.0 expression:

//b[.='Some unique string']/following::table[1] 

Meaning: the first following table element of any b element in the whole document having 'Some unique string' as string value

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜