所以我有这个 XML
<a>blah</a>
我想把它改成
<a>someValueIDoNotKnowAtCompileTime</a>
目前,我正在查看这个 SO question。但是,这只是将值更改为“2”
我想要的是完全相同的东西,但是能够定义值(以便它可以在运行时更改 - 我正在从文件中读取值!)
我尝试将值传递给被覆盖的方法,但这不起作用 - 到处编译错误(显然)
如何使用动态值更改静态 xml?
添加代码
var splitString = someString.split("/t") //where someString is a line from a file
val action = splitString(0)
val ref = splitString(1)
xmlMap.get(action) match { //maps the "action" string to some XML
case Some(entry) => {
val xmlToSend = insertRefIntoXml(ref,entry)
//for the different XML, i want to put the string "ref" in an appropriate place
}
...