You should be getting some sort of Exception with useful information as to why it didn't work. With JAXP 1.1, I use a chain of catch statements as follows - where tf is a File object
try {
System.out.println("loadDOM from: " + tf.getAbsolutePath() );
// Jaxp 1.1 style
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating( false );
dbf.setNamespaceAware( false );
dbf.setIgnoringElementContentWhitespace( true );
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse( tf );
}catch( ParserConfigurationException pce){
System.out.println("Parser: " + pce );
}catch(SAXParseException spe ){
StringBuffer sb = new StringBuffer( spe.toString() );
sb.append("\n Line number: " + spe.getLineNumber());
sb.append("\nColumn number: " + spe.getColumnNumber() );
sb.append("\n Public ID: " + spe.getPublicId() );
sb.append("\n System ID: " + spe.getSystemId() + "\n");
String tmp = sb.toString();
System.out.print( tmp );
}catch( SAXException se ){
System.out.println("createDocument threw " + se );
se.printStackTrace( System.out );
}
Bill
------------------
author of: