scala String to scala.xml.Elem

ε祈祈猫儿з 提交于 2019-12-03 09:04:57

问题


I have to convert a string into 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:


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


来源:https://stackoverflow.com/questions/25152738/scala-string-to-scala-xml-elem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!