scala-xml icon indicating copy to clipboard operation
scala-xml copied to clipboard

PrettyPrinter strips newlines from text in nodes, even pcdata

Open mbeckerle opened this issue 9 years ago • 0 comments

Migrated from https://issues.scala-lang.org/browse/SI-4303.

There is substantial discussion there that is not reproduced here.

Original description:

What steps will reproduce the problem

scala> <foo>{"hi\nthere"}</foo>
res6: scala.xml.Elem =
<foo>hi
there</foo>

scala> new PrettyPrinter(9999,2).format(<foo>{"hi\nthere"}</foo>)
res7: String = <foo>hi there</foo>

scala> new PrettyPrinter(9999,2).format(<foo>{PCData("hi\nthere")}</foo>)
res8: String = <foo><![CDATA[hi there]]></foo>

mbeckerle avatar Jul 29 '15 14:07 mbeckerle