我有一些html,如下所示:
<html>
<body>
... other html stuff ...
<form method="post" action="goSomewhere">
<input type="hidden" value="something">
<input type="hidden" value="something2">
<table>
<tr><td><input type="checkbox" name="123">Stuff 1</td></tr>
<tr><td><input type="checkbox" checked name="456">Stuff 2</td></tr>
<tr><td><input type="checkbox" name="789">Stuff 3</td></tr>
</body>
</html>除了带有特定名称的标记(innerhtml,即)之外,我正在尝试选择<form>中的所有内容。下面是我使用的查询:
$query = "//form//td[not(normalize-space() = 'Stuff 2')]"; 这成功地过滤掉了特定内容的<td>,但问题是它只返回<td>内容。如您所见,还有其他<input>不在<table>中,我也需要这些。
有人能帮忙做这个查询吗?谢谢!
发布于 2015-12-30 17:36:41
你在找//form//td[not(normalize-space() = 'Stuff 2')]/input|//input[not(ancestor::table)]。
https://stackoverflow.com/questions/34533698
复制相似问题