XML formatting PrettyPrinterremoves newline characters from character data. How to prevent this?
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>
Also see https://lampsvn.epfl.ch/trac/scala/ticket/4303 .
source
share