我网站上的部分HTML(http://example.com)是:
//if my HTML code is:
<div class="text-co">
<div class="title">
<a href="">00</a>
<a href="">11</a>
<a href="">22</a>
</div>
</div>
<div class="text-co">
<div class="title">
<a href="">33</a>
<a href="">44</a>
<a href="">55</a>
</div>
</div>
我的android代码是:
String url = "http://example.com";
ProgressDialog mProgressDialog;
@Override
protected Void doInBackground(Void... params) {
try {
Document document = Jsoup.connect(url).get();
Elements description = document.select("div[class=title] a");
desc = description.text();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
我希望在第一行中显示' 00 ',在第2行显示'11',依此类推。
例如:
00,00 11 ...
答案 0 :(得分:0)
尝试:
Elements description = document.select("div[class=title]");
Elements aTags = description.select("a");
for(Element tag : aTags) {
String value = tag.text();
}
它与你一起工作?