code: public static File getFile(NodeList fileNodes) {
      File file = null;
      for (int i = 0; i < fileNodes.getLength(); i++) {
        Element e = (Element) fileNodes.item(i);
        String type = e.getAttribute("type");
  
        try {
          // URL, File, or Resource
          if (type.equals("url")) {
            URL url = new URL(e.getTextContent());
            file = new File(url.toURI());
          } else if (type.equals("file")) {
            file = new File(e.getTextContent());
          } else if (type.equals("resource")) {
            ClassLoader cl = Thread.currentThread()
                    .getContextClassLoader();
            file = new File(cl.getResource(e.getTextContent())
                    .getFile());
          } else {
            System.out
                    .println("Incorrect file reference:  Unknown type!");
          }
        } catch (Exception exception) {
          System.err.println("Error getting file. "
                  + exception.getMessage());
          jlogger.log( SEVERE,
                  "Error getting file. " + exception.getMessage(), e);
  
          return null;
        }
      }
      return file;
    }
docs: Get a File pointer to a file reference (in XML)