我試圖拉nobr標籤之間的文本。幫助使用xpath從HTML表中提取文本
這是表的一部分:
<table class="report-main-table dirLTR NormalTxt" width="100%" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td class="report-data-title-cell report-data-column-odd"><nobr><b>סה"כ עלות בש"ח</b></nobr></td><td class="report-data-title-cell report-data-column-even"><nobr><b>יעד השיחה</b></nobr></td><td class="report-data-title-cell report-data-column-odd"><nobr><b>סוג שיחה</b></nobr></td><td class="report-data-title-cell report-data-column-even"><nobr><b>סה"כ זמן אויר לחיוב</b></nobr></td><td class="report-data-title-cell report-data-column-odd"><nobr><b>המספר שחויג</b></nobr></td><td class="report-data-title-cell report-data-column-even"><nobr><b>שעת שיחה</b></nobr></td><td class="report-data-title-cell report-data-column-odd"><nobr><b>תאריך שיחה</b></nobr></td>
</tr>
</thead>
<tr class="report-data-row-even">
<td class="NormalTxt report-data-cell report-data-column-even"><nobr>0.0285</nobr></td><td class="NormalTxt report-data-cell report-data-column-odd"><nobr>פרטנר</nobr></td><td class="NormalTxt report-data-cell report-data-column-even"><nobr>SMS</nobr></td><td class="NormalTxt report-data-cell report-data-column-odd"><nobr>1</nobr></td><td class="NormalTxt report-data-cell report-data-column-even"><nobr>054-2570130</nobr></td><td class="NormalTxt report-data-cell report-data-column-odd"><nobr>00:14:09</nobr></td><td class="NormalTxt report-data-cell report-data-column-even"><nobr>27/09/2010</nobr></td>
</tr>
<tr class="report-data-row-odd">
<td class="NormalTxt report-data-cell report-data-column-even"><nobr>0.0000</nobr></td><td class="NormalTxt report-data-cell report-data-column-odd"><nobr>סלקום</nobr></td><td class="NormalTxt report-data-cell report-data-column-even"><nobr>SMS</nobr></td><td class="NormalTxt report-data-cell report-data-column-odd"><nobr>1</nobr></td><td class="NormalTxt report-data-cell report-data-column-even"><nobr>052-3669127</nobr></td><td class="NormalTxt report-data-cell report-data-column-odd"><nobr>00:47:25</nobr></td><td class="NormalTxt report-data-cell report-data-column-even"><nobr>27/09/2010</nobr></td>
</tr>
我嘗試這個XPath表達式://表/ TR/TD/NOBR /,但這並沒有工作。
什麼是正確的xpath表達式?
謝謝
好問題,+1。查看我的答案,找到更短且可能更高效的解決方案。 :) – 2010-10-17 15:01:18