jaxp程式問題sos

freelanceer發表於2004-05-20
public class Conversion {
public static void main(String[] args) {
File f=null;
try
{
f = new File("data.xml");
if (!f.exists()) {
f.createNewFile();
}
}
catch(IOException r){

}


try {
DocumentBuilderFactory factory = BuilderFactory.newInstance();
//factory.setNamespaceAware(true);
//factory.setValidating(false);
DocumentBuilder builder = factory.newDocumentBuilder();
System.out.println("e");

Document document = builder.parse(f);
System.out.println("eo");

Conversion conversion=new Conversion(document);
}catch(Exception e){
System.out.println("eorror!");
}
}
為什麼總是顯示
e
eorror!
意思是Document document = builder.parse(f);這句話總是產生異常???

相關文章