请看下面的链接
http://finance.yahoo.com/q/op?s=C
我需要获得这一行文字
View By Expiration: Sep 10 | Oct 10 | Dec 10 | Jan 11 | Mar 11 | Jan 12
其中的
Sep 10 | Oct 10 | Dec 10 | Jan 11 | Mar 11 | Jan 12
于是我用firebug,看了一下,
/html/body/div/div[3]/table[2]/tbody/tr[2]/td/
这样表达不行,会得到许多其他的东西,请问,如何写这个xpath表达式?
http://finance.yahoo.com/q/op?s=C
我需要获得这一行文字
View By Expiration: Sep 10 | Oct 10 | Dec 10 | Jan 11 | Mar 11 | Jan 12
其中的
Sep 10 | Oct 10 | Dec 10 | Jan 11 | Mar 11 | Jan 12
于是我用firebug,看了一下,
/html/body/div/div[3]/table[2]/tbody/tr[2]/td/
这样表达不行,会得到许多其他的东西,请问,如何写这个xpath表达式?
解决方案 »
- 分享到QQ空间问题,急。。。在线等
- 如何实现动态读取数据库显示下拉菜单?
- WEB的TAB页问题:在网页中的某一TAB页操作,成功后返回时如何才能定位到刚才操作的TAB页?
- 如何利用JS来处理数据并生成页面??
- 如何修改http头里的HTTP_REFERER
- 如何在状态拦中显示IP
- ********第一次问问题,请帮忙!!!!!!***********
- 关于<select>元素的一个问题。
- “innerHTML”,“insertRow”之类的语句是出之标准的javascript吗?
- js因为数据量大 在ie8下出现 运行缓慢提示 运行不了啊
- 找span的值
- 高分求如何判断浏览器是32位还是64位
| <a href="http://finance.yahoo.com/q/op?s=C&m=2010-10">Oct 10</a>
| <a href="http://finance.yahoo.com/q/op?s=C&m=2010-12">Dec 10</a>
| <a href="http://finance.yahoo.com/q/op?s=C&m=2011-01">Jan 11</a>
| <a href="http://finance.yahoo.com/q/op?s=C&m=2011-03">Mar 11</a>
| <a href="http://finance.yahoo.com/q/op?s=C&m=2012-01">Jan 12</a>
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td height="2"></td></tr></tbody></table>
<table class="yfnc_mod_table_title1" width="100%" border="0" cellpadding="2" cellspacing="0"><tbody><tr valign="top">
这里的内容省略
</table>
</td>
我用xpath到达<td>后,如何获得里面的<strong>Sep 10</strong>
| <a href="http://finance.yahoo.com/q/op?s=C&m=2010-10">Oct 10</a>
| <a href="http://finance.yahoo.com/q/op?s=C&m=2010-12">Dec 10</a>
| <a href="http://finance.yahoo.com/q/op?s=C&m=2011-01">Jan 11</a>
| <a href="http://finance.yahoo.com/q/op?s=C&m=2011-03">Mar 11</a>
| <a href="http://finance.yahoo.com/q/op?s=C&m=2012-01">Jan 12</a>
<table>
<tr>
<td>ok
<strong>Sep 10</strong>
| <a href="ttt">Oct 10</a>
| <a href="kkk">Dec 10</a>
<table>
<tr>
<td>
123
</td>
<td>
567
</td>
</tr>
</table>
</td>
</tr>
</table>
我用firefox打开如下:
ok Sep 10 | Oct 10 | Dec 10
123 567
如果,我这样写表达式
xpath('/html/body/table/tr/td')
获得输出
<td>ok
<strong>Sep 10</strong>
| <a href="ttt">Oct 10</a>
| <a href="kkk">Dec 10</a>
<table><tr>
<td>
123
</td>
<td>
567
</td>
</tr></table>
</td>
我需要的结果是:
ok
<strong>Sep 10</strong>
| <a href="ttt">Oct 10</a>
| <a href="kkk">Dec 10</a>
请问,如何写表达式?