我有一个XML链接:http://itunes.apple.com/us/rss/topfreeapplications/limit=100/xml。我想通过Jsoup获取所有内容。但是当我获得XML元素的内容时,我遇到了问题:
<im:image height="53">
http://a5.mzstatic.com/us/r1000/111/Purple/v4/3d/6a/2b/3d6a2b17-e46c-5609-1bdc-1a3935ed2e51/mzl.edqotirc.53x53-50.png
</im:image>
<im:image height="75">
http://a1.mzstatic.com/us/r1000/111/Purple/v4/3d/6a/2b/3d6a2b17-e46c-5609-1bdc-1a3935ed2e51/mzl.edqotirc.75x75-65.png
</im:image>
<im:image height="100">
http://a4.mzstatic.com/us/r1000/111/Purple/v4/3d/6a/2b/3d6a2b17-e46c-5609-1bdc-1a3935ed2e51/mzl.edqotirc.100x100-75.png
</im:image>
如何在im:image中获取价值内容?谢谢!
答案 0 :(得分:1)
Document doc = Jsoup.parse(html);
Elements elements = doc.select("im|image");
for (Element element: elements )
{
System.out.println(element.text());
}
答案 1 :(得分:0)
首先,Jsoup是一个HTML解析器,而不是XML。 第二:试试seletor:
doc.select("im:image").text();