【发布时间】:2014-05-20 03:37:25
【问题描述】:
如何从迭代器中获取 url,我使用的是 jsoup。
我尝试做urls.add(ite.next().parentNode().attributes().asList().get(0).toString());,但值不是需要的。
【问题讨论】:
-
你是如何得到这个迭代器的?它在迭代什么?
asList()在我看来很可疑;您应该按名称而不是按位置获取属性。如果有<a title="Yo" href="http://whatever"></a>这样的标签怎么办? -
你得到了什么价值?
-
David Conrad,Iterator
ite = table.select("FONT[style=FONT-SIZE: 10pt]").iterator();获取迭代器。我知道 asList() 不正确 -
Vishrant,例如“my_url.htm”
-
我解决了问题:ite.next().parentNode().attributes().html().toString();