Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Xpath基于上一个同级文本在br之前选择text()_Html_Xpath_Siblings - Fatal编程技术网

Html Xpath基于上一个同级文本在br之前选择text()

Html Xpath基于上一个同级文本在br之前选择text(),html,xpath,siblings,Html,Xpath,Siblings,我有以下HTML代码: <td width="220" align="left"> <b>Valor da Venda:</b> R$ 650.000,00<br> <b>Valor do IPTU:</b> R$ 0,00<br> <b>Valor do Condomínio:</b> R$ 0,00 </td> 但这又

我有以下HTML代码:

<td width="220" align="left">
    <b>Valor da Venda:</b> 
    R$ 650.000,00<br>
    <b>Valor do IPTU:</b> 
    R$ 0,00<br>
    <b>Valor do Condomínio:</b> 
    R$ 0,00
</td>
但这又回来了

[' R$ 650.000,00', ' R$ 0,00', ' R$ 0,00 ']
而我只想退还第一笔650.000,00雷亚尔


提前感谢您的帮助

虽然这与要求不完全一样,但这可能是您的解决方案吗

/td/b[.="Valor da Venda:"]/following-sibling::text()[1]
或者,如果需要检查
br

/td/b[.="Valor da Venda:"]/following-sibling::text()[1][following-sibling::br]'

由于某些原因,/br未被解释为标记b的同级。不知道为什么,您的两个解决方案(对我来说似乎是正确的)都适用于lxml xpath解释器=(我想可能是因为br没有关闭。取决于您使用的是什么,我想,如果我将其加载为HTML,这在PHP DOM中是有效的。如果我将其加载为XML,当然,如果失败,因为这不是XML。您使用的是什么?
/td/b[.="Valor da Venda:"]/following-sibling::text()[1][following-sibling::br]'