请问解决这个问题?任何帮助?
ERROR : java.net.MalformedURLException: Protocol not found: /mnt/sdcard/EREADER/NewForestPonies/OEBPS/content.opf
代码:
//Getting the xhtml file names
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
String
Document doc = db.parse(new InputSource(Environment.getExternalStorageDirectory()+"/EREADER/"+book_name+"/OEBPS/content.opf")); //ERROR HERE
doc.getDocumentElement().normalize();
..........
......
编辑: 对于SAX PARSER:?
DataSaxHandler myXMLHandler = new DataSaxHandler();
xr.setContentHandler(myXMLHandler);
xr.parse(new InputSource(Paths.getBookStorePath()+bookname+"/OEBPS/content.opf"));
答案 0 :(得分:2)
试试这个,让我知道发生了什么......
File fXmlFile = new File(Paths.getBookStorePath()+book_name+"/OEBPS/content.opf");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fXmlFile);
doc.getDocumentElement().normalize();