I'm trying to open an XML file in java to be parsed through the use of Document Builder and whenever I try to open up the file that I have, it get the error:
java.io.FileNotFoundException:~/batch_files/batch_2783/output/english/batch_2783/apf.v5.1.2.dtd (No such file or directory)
Which is really odd, because the file directory that I"m using is this:
~/batch_files/batch_2783/output/english/batch_2783/AFP_ENG_20090619.0251.sgm.apf
Just to note, I changed the earlier directories to a '~' for security reasons. So it's changing the end of the pathname? It's getting rid of the AFP_ENG_20090619.0251.sgm for some reason. Here's the entire set of code:
// Open up the XML file using Document builder and the supplied pathname
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = null;
Document doc = null;
dBuilder = dbFactory.newDocumentBuilder();
try {
doc = dBuilder.parse(pathName);
} catch (SAXException | IOException ex) {
Logger.getLogger(FindAnnotation.class.getName()).log(Level.SEVERE, null, ex);
}
doc.getDocumentElement().normalize();
Now, If I had to guess what the problem is, it's that the name of the file that I'm trying to open contains '.' before the file extension. Does this mean I should rename the files and get rid of the '.' ?