我试图打开一个XML文件解析它,但我正在逐渐不再试图打开该文件。我的代码是:fileinputstream抛出filenotfoundexception?
try {
return new FileInputStream(location);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
其中位置是一个传入函数的字符串。一旦运行我的代码,我得到:
java.io.FileNotFoundException:/C:/Users/Seth/AndroidWorkspace/UCoupon/res/xml/information.xml(没有这样的文件或目录)
我给完整的文件路径,而且我没有任何拼写错误。我究竟做错了什么?
我看着成但无法理解它如何适应我的代码。我实现了一个自定义的XML解析器,就像这里的第八个示例:http://www.ibm.com/developerworks/opensource/library/x-android/index.html我正在尝试编写方法getInputStream(),以便我可以使用线 “Xml.parse(this.getInputStream(),Xml.Encoding.UTF_8,root.getContentHandler());” – 2011-02-02 02:13:04