[jdom-interest] testing for existance of xml file
Paul Phillips
paul at partitura.com
Tue Jun 25 08:15:46 PDT 2002
I'm sure this is an easy question. However, I am feeling my way in jdom,
so pointers are appreciated!
In code like this...
try {
SAXBuilder builder = new SAXBuilder();
Document aDocument = builder.build(new
File("/usr/local/tomcat/myfile2.xml"));
Element rootElement = aDocument.getRootElement();
Element childElement = rootElement.getChild("childElement");
result = childElement.getText();
} catch(JDOMException e) {
} catch(NullPointerException e) {
}
What is the best way to test for the existance of myfile2.xml. If it
doesn't exist, I want to create it. should I test to see if aDocument is
null?
Thanks
Paul Phillips
More information about the jdom-interest
mailing list