我正在使用mechanize/nokogiri,需要解析出以下HTML字符串。 任何人都可以帮助我用xpath语法来做到这一点或任何其他方法,将工作?Ruby Nokogiri解析HTML表
<table>
<tr class="darkRow">
<td>
<span>
<a href="?x=mSOWNEBYee31H0eV-V6JA0ZejXANJXLsttVxillWOFoykMg5U65P4x7FtTbsosKRbbBPuYvV8nPhET7b5sFeON4aWpbD10Dq">
<span>4242YP</span>
</a>
</span>
</td>
<td>
<span>Subject of Meeting</span>
</td>
<td>
<span>
<span>01:00 PM</span>
<span>Nov 11 2009</span>
<span>America/New_York</span>
</span>
</td>
<td>
<span>30</span>
</td>
<td>
<span>
<span>[email protected]</span>
</span>
</td>
<td>
<span>39243368</span>
</td>
</tr>
.
.
.
<more table rows with the same format>
</table>
我想这个作为输出
"4242YP","Subject of Meeting","01:00 PM Nov 11 2009 America/New_York","30","[email protected]", "39243368"
.
.
.
<however many rows exist in the html table>
没有完全使用你的例子,但它让我想到了不同的方法。谢谢您的帮助! – thomas 2009-11-18 19:21:11
是的,我只能冒险猜测你的HTML格式是如何可预测的,以及嵌套跨度的加入有多重要,所以你可以从极简主义中工作。 – JasonTrue 2009-11-18 19:35:18