這是代碼
public void onClick(View v) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
System.out.println("111111111");
//String url = "home/czj/workspace/Donload/my.xml";
// Uri uri = Uri.parse(url);
//URL url = uri.
//File file = new File("file:///workspace/Donload/my.xml");
InputStream is= new FileInputStream("/home/czj/workspace/Donload/src/res/my.xml");
//FileInputStream in = new FileInputStream(file);parse("file://home/czj/workspace/Donload/my.xml");
System.out.println("222222");
//org.w3c.dom.Document document = builder.parse(new ByteArrayInputStream(data.getBytes()));
org.w3c.dom.Document document = builder.parse(new ByteArrayInputStream(data.getBytes()));
這是報錯
java.io.FileNotFoundException: /home/czj/workspace/Donload/src/res/my.xml: open failed: ENOENT (No such file or directory)
你路徑寫錯了吧,Donload是不是download