0
我试图将下面列表中的“”(info.net,test.com等)之间的文本与jsoup相加,并将它们添加到arraylist中。JSoup没有解析元素
<?xml version="1.0" encoding="UTF-8"?>
<supported-filehosts>
<host url="info.net"/>
<host url="test.com"/>
<host url="app.to"/>
</supported-filehosts>
似乎很容易,但我不能老是用右键下面的代码获得它:
Document doc = Jsoup.parse(HOSTS);
Elements links = doc.select("host[url]");
for (Element link : links) {
hostUrls.add(link.text());
}
有人能看看。
嗨TDG,thx回复,但不幸hostUrls仍然是空的 – Simon
我已经添加**完整的代码**,适合我。 – TDG
奇怪,我现在给链接直接解析(Document doc = Jsoup.parse(“http://test.org/filehosts.xml”);还没有什么 – Simon