首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

org.xml.sax.SAXException :File "c:\xml\reports.xml"not found

2014-01-26 
异常如下:org.xml.sax.SAXException :File "c:\xml\reports.xml"not found代码如下:try {// Crea

异常如下:

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这个文件有吗?

        

热点排行