public static boolean isValidXML(String path) throws IOException {

		File f = new File(path);

		if (f.exists() && !f.isDirectory()) {
			// check if XML
			String extension = "";

			int i = path.lastIndexOf('.');
			if (i > 0) {
				extension = path.substring(i + 1);
				if (extension.equalsIgnoreCase("XML")) {
					return true;
				}
			}
			return false;
		} else {
			return false;
		}
	}