org.dom4j.DocumentException: unknown protocol: d Nested exception: unknown protocol: d
异常错误。
通过查阅相关资料:
问题的原因是Tomcat的安装路径有空格.d是Tomcat安装的盘符.
解决方案:
1.重新安装Tomcat.去掉空格.
2.将解析的XML文档转换为File类型.
原始代码:
String path = "E:\\test.xml";
SAXReader reader = new SAXReader();
Document document = reader.read(path);
修改后的代码:
String path = "E:\\test.xml";
File file = new File(path);
SAXReader reader = new SAXReader();
Document document = reader.read(file);