我有点困惑如何编辑 xml 内容,例如我有一个 xml 文件
<configuration>
<steps>
<step>
<step1>abc</step1>
<step2>def</step2>
</step>
<step>
<step1>pqr</step1>
<step2>xyz</step2>
</step>
</steps>
</configuration>
如何将“xyz”编辑为“stu”
我尝试使用 commons-configuration-1.6.jar 的 XMLConfiguration
setProp(String name, String tochange){ // here I pass name as "pqr" , toChange as "stu"
XMLConfiguration config = new XMLConfiguration("config.xml");
//TODO: config.setProperty("steps.step.step2",tochange); Here I am not sure what to do..
}