在外部一个activity的onCreat中调用的 文件已经存在 而且使用其他方式读取正常 求高手帮忙!public ArrayList<HashMap<String, String>> ReadXML(){
ArrayList<HashMap<String, String>> userInfo = new ArrayList<HashMap<String, String>>();
HashMap<String, String> userTable = new HashMap<String, String>();
SAXBuilder builder = new SAXBuilder();
Document read_doc = null;
Log.v("PUSH", "ReadOneUser-InitFinsh");
try {
//已经验证 文件存在
read_doc = builder.build("/sdcard/PushUp/userInfo.xml");
} catch (JDOMException e1) {
Log.v("PUSH", "ReadOneUser-e1");
e1.printStackTrace();
} catch (IOException e2) {
Log.v("PUSH", "ReadOneUser-e2");
//就是跳到这里出了个异常 导致的程序异常退出。求帮忙。
e2.printStackTrace();
}
Element user = read_doc.getRootElement();
List<Element> list = user.getChildren("user");
for (int i = 0; i < list.size(); i++) {
Element e = list.get(i);
userTable.put("name", e.getAttributeValue("name"));
userTable.put("sex", e.getAttributeValue("sex"));
userTable.put("high", e.getAttributeValue("high"));
userTable.put("weight", e.getAttributeValue("weight"));
userTable.put("age", e.getAttributeValue("age"));
userInfo.add(userTable);
Log.v("PUSH", "ReadOneUser-" + e.getAttributeValue("name"));
}
return userInfo;
}

解决方案 »

  1.   

    使用其他方式读取正常????
    这个xml是不是格式有问题,或者编码有问题
      

  2.   

    等我把xml也发上来 
    <?xml version="1.0" encoding="UTF-8"?>
    <user-info>
      <user>
        <name>testUser</name>
        <sex>man</sex>
        <high>180</high>
        <weight>80</weight>
        <age>20</age>
      </user>
    </user-info>
      

  3.   

    更关键的是我在其他地方测试通过了才加到android里的。。
      

  4.   

    。你确定路径是对的??一般路径都是  /mnt/sdcard/xxxx
      

  5.   

    没有log信息怎么搞啊,锤子啊