2011-04-19 67 views
5

PrettyPrinter XML格式化程序從字符數據中刪除換行符。我如何防止這種情況?如何防止Scala的XML PrettyPrinter類刪除換行符

scala> import scala.xml._ 
import scala.xml._ 

scala> """line one 
    | line two""" 
res0: java.lang.String = 
line one 
line two 

scala> new PrettyPrinter(999, 3).format(Elem(null, "multiline", Null, TopScope, PCData(res0))) 
res1: String = <multiline><![CDATA[line one line two]]></multiline> 

另請參閱https://lampsvn.epfl.ch/trac/scala/ticket/4303

回答