我正在解析来自网站的 HTML 文件,但在从文件中获取所有数据时遇到问题。
<tr>
<td class="color_line1" valign="center" align="left">Cemopel - Cm Petroleo Ltda.</td>
<td class="color_line1" valign="center" align="left">Avenida Rui Barbosa, 879 0</td>
<td class="color_line" valign="left"><a class="linkpadrao" href="javascript:Direciona('GRA%C3%87AS');">Gra###</a></td>
<td class="color_line" valign="center" align="center">SHELL</td>
<td class="color_line" valign="center" align="center">2,899</td>
<td class="color_line" valign="center" align="center"> - </td>
<td class="color_line" valign="center" align="center">-</td>
<td class="color_line" valign="center" align="center">-</td>
<td class="color_line" valign="center" align="center">04/09/2013</td>
</tr>
文件的另一部分:
<tr>
<td class="lincol" valign="center" align="left">E.u. Ten#### Neto Combust###is</td>
<td class="lincol" valign="center" align="left">Avenida Marechal Mascarenhas de Morais, 4900 </td>
<td valign="left"><a class="linkpadrao" href="javascript:Direciona('IMBIRIBEIRA');">Imbiribeira</a></td>
<td valign="center" align="center">COSAN COMBUST##EIS</td>
<td valign="center" align="center">2,899</td>
<td valign="center" align="center">2,505</td>
<td valign="center" align="center">CIF</td>
<td valign="center" align="center">-</td>
<td valign="center" align="center">04/09/2013</td>
</tr>
<tr>
我正在使用“linkpadrao”类,使用父母来获取数据。它工作正常,但我无法获得“linkpadrao”类以上的数据:
posto.parent.search('~ td').map &:text
有任何想法吗?