假设我有以下代码:
import scala.xml._
def foo(bar:String) = s"The FOO is $bar"
var xml =
<a type ={foo("attribute")}>
{foo("text node")}
</a>
val txt = "<a>{foo(\"updated\")}</a>"
XML.loadString(txt)
这导致
xml: scala.xml.Elem = <a>{foo("updated")}</a>
制作它的规范方法是什么
xml: scala.xml.Elem = <a>The FOO is updated</a>
甚至可以不进行反思吗?