2014-09-13 72 views
1

我無法使用Jsoup獲取this的數據。它可以連接,如果我用這個:如何在Android中解析Jsoup?

Connection connection = Jsoup.connect("http://android-forum.hu/feed.php"); 

但是,如果我想獲得該網站的數據,我得到這個exeption:

org.jsoup.UnsupportedMimeTypeException: Unhandled content type. Must be text/*, application/xml, or application/xhtml+xml. Mimetype=application/atom+xml; charset=UTF-8, URL=http://android-forum.hu/feed.php 

我用這個代碼:

Document doc = Jsoup.connect("http://android-forum.hu/feed.php").get(); 

所以我想要獲取頁面數據。如何得到它?

回答

1

當響應的minetype不受支持時,會拋出UnsupportedMimeTypeException

您可以使用ignoreContentType(true)讓Jsoup忽略minetype,嘗試

+0

謝謝

Document doc = Jsoup.connect("http://android-forum.hu/feed.php") .ignoreContentType(true) .get(); 

.get稱呼它)!!!!有用! :))) – 2014-09-13 18:43:22

+0

沒有問題:)接受的答案,如果一切正常 – 2014-09-13 18:44:17

+0

此外,如果該數據包含不支持的字符,如「A」怎麼寫的屏幕?因爲我得到了「&」或「;」或類似的東西... – 2014-09-13 18:49:51