sp.parse(new File ("C:\123.xml"), this);这里会出现错误..找不到 file..  因为有\
help me?SAXParserFactory spf = SAXParserFactory.newInstance();
try {

SAXParser sp = spf.newSAXParser();

sp.parse(new File ("C:\123.xml"), this);

}catch(SAXException se) {
se.printStackTrace();
}catch(ParserConfigurationException pce) {
pce.printStackTrace();
}catch (IOException ie) {
ie.printStackTrace();
}

解决方案 »

  1.   

    你没有为\加上转义符,应该这样写:c:\\123.xml
      

  2.   

    这个转义符号在windows和linux下是不同的
      

  3.   


    谢谢...可以用呀..我用 JFileChooser 获得path, 它不懂加 "\"有什么方法解决..?
     
      

  4.   

    String path = "C:\Documents and Settings\Administrator\My Documents\DataXML.xml"path.replace('\\\\', '\\');这样?
      

  5.   

    替换字符串中的字符:replace(char old,char new) 用new替换old;