scala String to scala.xml.Elem

时间:2014-08-06 05:18:10

标签: xml string scala scala-xml

我必须将字符串转换为XML

scala> val string="<play><scala></scala></play>"
string: String = <play><scala></scala></play>

scala> val xml=(<play><scala></scala></play>)
xml: scala.xml.Elem = <play><scala></scala></play>

1 个答案:

答案 0 :(得分:50)

scala> scala.xml.XML.loadString(string)
res0: scala.xml.Elem = <play><scala/></play>