我的代码适用于任何RSS提要,如BBC和fakeapi以及sciencemag等。 ..但我试图使用fifa.com的RSS feed和ResponseCode结果总是= 404
我现在要做什么,请??? 这是我的连接代码
//String address ="http://www.sciencemag.org/rss/news_current.xml";//worked
// String address = "http://feeds.bbci.co.uk/news/world/rss.xml";// worked
String address =“http://www.fifa.com/rss/index.xml”; // 404错误代码
public Document httpconnection() {
try {
url = new URL(address);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
Log.e("TAG", "connection.getResponseCode()" + a);
InputStream inputStream = connection.getInputStream();
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = builderFactory.newDocumentBuilder();
Document xmlDoc = builder.parse(inputStream);
return xmlDoc;
} catch (Exception e) {
e.printStackTrace();
return null;
}
提前致谢