0

我正在尝试从 RSS 提要中逐行阅读。

我不断收到这个错误;

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());

            }

        }
4

1 回答 1

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);
于 2013-06-19T19:30:22.740 回答