异常如下:
org.xml.sax.SAXException :File "c:\xml\reports.xml"not found
代码如下:
try {
// Create the builder
DocumentBuilder domBuilder = newBuilder(false);
// Parse the file
doc = domBuilder.parse(new File(path));
String expr = "/document/@type";
Node attr = XPathAPI.selectSingleNode(doc,expr);
setType((new Integer(attr.getNodeValue())).intValue());
} catch(SAXParseException spe) {
spe.printStackTrace();
throw new NoSuchNameException
("there is no such table or chart with the name you gave!\nplease check your input and try again!\n");
} catch(Exception e) {
e.printStackTrace();
}
我在一台机器上开发的,没有问题,当移到另一台机器就报这个Exception,文件是在那个目录存在的,在代码中进行文件操作是没有问题的
------解决方法--------------------------------------------------------
servlet OR application?
------解决方法--------------------------------------------------------
xml文件不存在啊
c:\xml\reports.xml这个文件有吗?