Java tutorial
//package com.java2s; import java.io.File; public class Main { private static File toFile(final File rootDir, final String path) { File file = rootDir; for (final String pathComponent : path.split("\\.")) { file = new File(file, pathComponent); } file = new File(file.getParentFile(), file.getName() + ".xml"); return file; } }