我需要更换sEmployee和sWUnumber值多值(突出表现在上面黄色)如何在XML标记替换值时,节点在使用JAVA
到目前为止,我所能做的就是替换节点值和其他属性。但是,当在标签。我似乎无法取代sEmployee和SWUnumber。我认为这些元素不是属性?
继承人到目前为止我做了什么。
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(Constant.Path_OldXmlFile);
// Get Employee ID, I'm getting my values in excel data so don't mind this
String sNewEmployeeID = ExcelUtils.getCellData(iTestCaseRow,
Constant.Personnel_NewEmployeeID);
// Get Work Unit Number, I'm getting my values in excel data so don't mind this
String sWorkUnitNumber = ExcelUtils.getCellData(iTestCaseRow,
Constant.Personnel_WorkUnit);
获取'Node''BODID',得到它的价值,使用一个简单的'String#replace',然后将新值重新设置为'Node'并保存 – MadProgrammer