String oaFilePath = "F:\\work\\oa.xml";
String message = getFileString(oaFilePath);
Document doc = XmlUtils.parseText(message);
Element rootElement = doc.getRootElement();
String filePath = rootElement.element("Projects").
element("ProjectRow").element("ProjectItem")
.element("StorageUrl").getTextTrim();
//java裏面\是轉義字符 \\前面一個就是轉義,就等於一個\ 。 \\\\ 四個轉義下不就是\\
filePath = filePath.replaceAll("\\\\", "/");
//另一種方法 filePath.replace('\\', '/'); 可以實現同一種效果
//share2是要替換的值 tobi3爲替換後的值
filePath = filePath.replace("share2", "tobi3");
System.out.println(filePath);
轉義前後