2 개의 다른 테이블에 동일한 td의 2 개의 occourances가 있습니다.xpath를 사용하여 html로 두 번째 td를 찾는 방법
나는이를 사용하여 1 하나의 값 '예'를 얻을 수 있어요 :
//h:td[1][*[contains(.,'Loudspeaker')]]/../h:td[last()]/text()
하지만 2 하나의 값 '음성 75dB/소음 66dB/링 75dB'을 얻고 있지. 나는 시도 :
//h:td[2][*[contains(.,'Loudspeaker')]]/../h:td[last()]/text()
나는 HTML과 XPath는 그렇게 나와 함께 곰하시기 바랍니다 매우 새로운 오전. 내 HTML의
부분 :
</table><table cellspacing="0">
<tr>
<th rowspan="3" scope="row">Sound</th>
<td class="ttl"><a href="glossary.php3?term=call-alerts">Alert types</a></td>
<td class="nfo">Vibration; MP3, WAV ringtones</td>
</tr>
<tr>
<td class="ttl"><a href="glossary.php3?term=loudspeaker">Loudspeaker</a> </td>
<td class="nfo">Yes</td>
</tr>
. .
<table cellspacing="0">
<tr>
<th rowspan="5" scope="row">Tests</th>
<td class="ttl"><a href="xyz.php">Display</a></td>
<td class="nfo">
<a class="noUnd" href="http://xyz.php">Contrast ratio: Infinite (nominal)/3.419:1 (sunlight)</a></td>
</tr><tr>
<td class="ttl"><a href="xyz.php">Loudspeaker</a></td>
<td class="nfo">
<a class="noUnd" href="http://xyz.php">Voice 75dB/Noise 66dB/Ring 75dB</a></td>
</tr><tr>
.. 미리
감사합니다.
당신이 모든 일을 게시하시기 바랍니다 수 있습니까? 둘 다 td를 포함하는 공통 상위 블록을 사용하여 샘플 html을 다시 만들 필요가 없습니다. –
html 페이지는 약 800 줄입니다. 그러나이 웹 사이트 페이지에서 html을 얻을 수 있습니다. 이것으로 충분하길 바란다. (http://www.gsmarena.com/samsung_galaxy_s_duos_s7562-4883.php) – MSR13