我正在尝试从RSS Feed中逐行阅读。
我一直收到这个错误;
java.io.FileNotFoundException :( Android App的位置名称)
自从它被读取后,从RSS提要并实际输出一些xml我看不出哪里可能有错误。有人遇到过这个问题吗?
URL url = new URL(urlText);
in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine=in.readLine()) != null) {
System.out.println(inputLine);
count++;
try{
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder= dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(inputLine);
doc.getDocumentElement().normalize();
}
catch(MalformedURLException e){
System.out.println(e.getMessage());
}
}
答案 0 :(得分:0)
我猜你是代理的背后,这就是你遇到url.openStream()问题的原因。尝试设置代理配置,希望它能正常工作。
String proxyUser = "";
String proxyPassword = "";
String proxyAddress = "";
int proxyPort = 8080;
InetSocketAddress sa = new InetSocketAddress(proxyAddress, proxyPort);
Proxy proxy = new Proxy(Proxy.Type.HTTP, sa);
URLConnection conn = url.openConnection(proxy);