修改前代码:
1 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 2 DocumentBuilder builder = factory.newDocumentBuilder(); 3 Document document = builder.parse(xmlPath);\\直接将路径名给builder.
修改后代码:
1 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 2 DocumentBuilder builder = factory.newDocumentBuilder(); 3 Document document = builder.parse("file:///" + xmlPath);