【发布时间】:2015-06-02 18:22:22
【问题描述】:
我试图仅捕获字符串的 first 部分,但作为新手,我对如何格式化 xPath 表达式感到困惑。在下表中,我只想要第三行/第三单元格中的律师姓名 - 在中断标记之前。
我可以通过以下方式进入牢房:
//tr[contains(.,'Plaintiff')]/following-sibling::tr[contains(.,'Attorney:')]/td[3]
但是如何编写包含“substring-before”的 xPath 表达式以返回
之前的所有内容?
这是我正在使用的表:
<table class="data">
<thead>
<tr class="head">
<th scope="COL">Type</th>
<th scope="COL">Name</th>
<th scope="COL">Disposition</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td class="">Plaintiff</td>
<td class="">
“Citibank, N.A.”
<br>
“None”
</td>
<td class="">CV-BT EntryJgmt-Clerk Default</td>
</tr>
<tr class="even xh-highlight">
<td class=""> </td>
<td class=""><b>Attorney:</b></td>
<td class="">
“Sue Yu”
<br>
“Dewey, Cheatum & Howe Law Offices
,
515 Burnitt St, Suite 400, San Jose, Ca 95119”
</td>
</tr>
<tr class="odd">
<td>Defendant</td>
<td>
“Emma Royds”
<br>
“None”
</td>
<td>CV-BT EntryJgmt-Clerk Default</td>
</tr>
</tbody>
</table>
【问题讨论】:
标签: xpath