Java tutorial
//package com.java2s; public class Main { public static String toXPathExper(String simplePath) { simplePath = simplePath.replaceAll("/([^/]+)", "/\\*[local-name()='$1']"); simplePath = simplePath.replaceAll("^/", "//"); return simplePath; } }