【发布时间】:2017-10-21 07:48:12
【问题描述】:
我有一些 HTML 代码
<li><h3>Number Theory - Even Factors</h3>
<p lang="title">Number N = 2<sup>6</sup> * 5<sup>5</sup> * 7<sup>6</sup> * 10<sup>7</sup>; how many factors of N are even numbers?</p>
<ol class="xyz">
<li>1183</li>
<li>1200</li>
<li>1050</li>
<li>840</li>
</ol>
<ul class="exp">
<li class="grey fleft">
<span class="qlabs_tooltip_bottom qlabs_tooltip_style_33" style="cursor:pointer;">
<span>
<strong>Correct Answer</strong>
Choice (A).</br>1183
</span>
Correct answer
</span>
</li>
<li class="primary fleft">
<a href="factors_6.shtml">Explanatory Answer</a>
</li>
<li class="grey1 fleft">Factors - Even numbers</li>
<li class="orange flrt">Medium</li>
</ul>
</li>
在上面的 HTML sn-p 中,我试图提取 <p lang="title"> Notice how it has <sup></sup> and <sub></sub> tags being used inside.
我的 Xpath 表达式 .//p[@lang="title"]/text() 不检索 sub 和 sup 内容。我如何在下面得到这个输出
期望的输出
Number N = 2<sup>6</sup>*5<sup>5</sup> * 7<sup>6</sup> * 10<sup>7</sup>; how many factors of N are even numbers?
【问题讨论】:
-
您使用哪种语言来解析 HTML 并执行 XPath 查询?
标签: xpath html-parsing