【发布时间】:2020-02-03 15:24:41
【问题描述】:
我有一个包含这些数据的字符串:
<div>
<a href='https://www.some.html'>
<img src='https://besttv232.jpg' alt='null' title='null' border='0' width='100' height='56'>
</a>
</div>
Some text is also over here
我需要用 Jsoup 解析它,我需要 a href url、img url 和数据(一些文本...)
我试过了:
Document doc = Jsoup.parse(myData); //myData is string with content above
Elements links = content.get("div");
for (Element link : links) {
String linkHref = link.attr("href");
String linkHrefa = link.attr("img");
String linkText = link.text();
}
【问题讨论】: