【发布时间】:2026-02-10 19:55:02
【问题描述】:
您好,我想在“cotation”之后获取值,但我不知道该怎么做。
<span id="brs-sl57350199c5a53">
<span class="cotation">16.33 (c)</span>
</span>
我正在使用 Jsoup,这是我的代码:
Document doc = Jsoup.connect("http://www.boursorama.com/bourse/actions/cours_az.phtml").get();
Element loginform = doc.getElementById("content"); //brs-sl5734ff406037d
Elements inputElements = loginform.getElementsByTag("span");
for (Element inputElement : inputElements) {
String key = inputElement.attr("class");
System.out.println("Param name: "+ key);
}
这就是我所拥有的:
Param name: cotation
你有什么想法能够获得价值而不是“coation”吗?
提前致谢。
【问题讨论】: