【发布时间】:2013-03-27 16:39:45
【问题描述】:
我有以下html sn-p
<span class='ocr_line' id='line_11' title="bbox 0 482 377 539">
<span class='ocrx_word' id='word_34' title="bbox 0 484 51 539"><em>WORD1</em></span>
<span class='ocrx_word' id='word_35' title="bbox 56 482 119 528">WORD2</span>
<span class='ocrx_word' id='word_35' title="bbox 56 482 119 528"><em></em></span>
<span class='ocrx_word' id='word_36' title="bbox 137 483 171 528"><strong><em>WORD3</em></strong></span>
<span class='ocrx_word' id='word_37' title="bbox 176 482 244 528"><h1>WORD4</h1></span>
</span>
我希望 xpath 查询字符串抓取单词 1-4 的 bbox 字符串和节点内容。我遇到了麻烦,因为这些词嵌套在 <em>s 和 <strong>s 中,并且可能也是空的!谢谢。
【问题讨论】: