Looking at the document, the goal is to select the second cell from the second row, in the first table.
我发表了以下言论:
//row/td[2]/text()[td[@class="identifier"]/span[text()="identifier"]]
但它并未退回任何款项。 不幸的是,我看不到什么错误。
对我来说,它看着alright。 表达方式应当:
select the text
in the second cell
in any row
where
the text of a span equals to "identifier"
and the span is located in cell with a "identifier" class
如果你能够指出我做错的话,我将不胜感激。
Sample XML文件:
<?xml version="1.0"?>
<html>
<table class="first">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td class="identifier">
<span>identifier</span>
</td>
<td>
foo
<span>ignore</span>
bar
</td>
</tr>
<tr>
<td>row 3, cell 1</td>
<td>row 3, cell 2</td>
</tr>
</table>
<table class="second">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td class="identifier">
<span>not an identifier</span>
</td>
<td>
not a target
</td>
</tr>
<tr>
<td>row 3, cell 1</td>
<td>row 3, cell 2</td>
</tr>
</table>
</html>