[jdom-interest] testing for existance of xml file
Shaun Smith
shauns at pixology.com
Tue Jun 25 08:41:50 PDT 2002
Well, the File.exists( ) method seems to be the most appropriate
way of checking if a file exists.
i.e.
File f = new File( "/whatever );
if( f.exists( ) )
{
// do stuff
}
>
> 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) {
>
> }
More information about the jdom-interest
mailing list