1

我找不到editItem:hello通过 Jsoup 选择跨度的方法。

<body>
<form id="editItem" name="editItem" method="post" action="/Project/gub.xhtml" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="editItem" value="editItem" />
<span id="editItem:hello">Hello Jsoup-World!</span>
</form>
</body>

我从Jsoup Selector Syntax Doc中尝试了很多好看的可能性,但从未成功。更改 HTML 不是一种选择。

4

2 回答 2

1

您是否尝试将选择器指定为:

span[id=editItem:hello]

您可以在http://try.jsoup.org/~lXJJZ0FNgs8E1uCSIzGW6PnCqmI看到它的工作原理。

于 2013-05-29T11:57:01.870 回答
0

我认为,当 id 中有冒号时,CSS-Selector 将不起作用。但是你可以使用 Document.getElementById(String id)

于 2013-05-29T11:15:50.947 回答