0

我有一个 Xpath 表达式如下:

//*[@id="my_element"]/table//select|//*[@id="my_element"]/table//input[@type!="hidden"]|//*[@id="my_element"]/table//textarea

如您所见,我想选择三种不同类型的元素selectinput[@type!="hidden"]并且textarea都在同一个父级中//*[@id="my_element"]/table

有没有更简洁的方法来写这个?我在想类似的事情:

//*[@id="my_element"]/table//(select|input[@type!="hidden"]|textarea)

但到目前为止,我的研究还没有产生任何结果。我尝试了同样的方法(descendant::select|descendant::input)(descendant::select|input)但似乎这些它们不起作用。

4

1 回答 1

0

您的“简洁”表单是有效的 XPath 2.0 表达式。所以答案是,使用 XPath 2.0。

于 2013-11-05T12:31:20.567 回答