【发布时间】:2018-10-25 11:04:18
【问题描述】:
这是我的 xpath
//dns:tbody//dns:td[1][@rowspan="1"]/text()
我想找到一个解决方案,如何让属性 rowspan @rowspan=" only number " 只接受数字
我正在寻找 XPath 1.0 中的正则表达式解决方案
正则表达式 =^[0-9]*$
我的问题我不知道如何将正则表达式与 XPath1.0 或任何其他解决方案集成
【问题讨论】:
-
使用 XPath 1.0 你不能,尽管使用正则表达式对于 XPath 2.0 来说是微不足道的。您可以使用
number()解决它 -
我的 xpath 会像
//dns:tbody//dns:td[1][@rowspan=number()]/text()??