【发布时间】:2011-09-19 08:38:39
【问题描述】:
我有这样的html代码:
<strong>Term:</strong>
Some text<br />
More text<br />
Some more lines of text
<strong>Term:</strong>
Some text<br />
More text<br />
Some more lines of text
<strong>Second term:</strong>
Some text<br />
More text<br />
Some more lines of text
<strong>Term:</strong>
Some text<br />
More text<br />
Some more lines of text
我需要在带有文本“Term”的标签之间和下一个标签之前获取文本节点:
Some text
More text
Some more lines of text
Some text
More text
Some more lines of text
Some text
More text
Some more lines of text
这里可以使用条件:前一个标签必须包含文本“Term”,但我不知道如何创建这样的xpath选择器。
【问题讨论】:
-
你好,我感觉问题不是很清楚。您能否发布所需的输出。可能到时候我就能明白你到底想要什么。
-
我更新了这个问题。对不起我的英语不好。
-
您已更改输入,请同时更新所需的输出。此外,添加有意义的文本以区分儿童 ndoes。根据您的描述,仍然很难理解您需要什么。
-
我已经扩展了我的答案,即使您仍然怀疑您的需求。看看你是否可以。
标签: xpath