Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrettyPrinter removes newlines #4543

Closed
scabug opened this issue May 4, 2011 · 5 comments
Closed

PrettyPrinter removes newlines #4543

scabug opened this issue May 4, 2011 · 5 comments

Comments

@scabug
Copy link

scabug commented May 4, 2011

=== What steps will reproduce the problem (please be specific and

scala> <foo>{PCData("hello\nworld")}</foo>
res51: scala.xml.Elem =
<foo><![CDATA[hello
world]]></foo>

scala> (new PrettyPrinter(Int.MaxValue, 2)).format(res51)
res52: String = <foo><![CDATA[hello world]]></foo>

=== What is the expected behavior? ===
Should print "hello\nworld"

scala> (new PrettyPrinter(Int.MaxValue, 2)).format(res51)
res52: String = <foo><![CDATA[hello\nworld]]></foo>

=== What do you see instead? ===
prints "hello world"

=== What versions of the following are you using? ===

  • Scala: 2.8.1
@scabug
Copy link
Author

scabug commented May 4, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4543?orig=1
Reporter: Ittay Dror (ittayd)

@scabug
Copy link
Author

scabug commented Jan 14, 2013

Hans-Peter Strr (hans-peter.stoerr) said:
Strangely, if you do new xml.PrettyPrinter(Int.MaxValue, 2).format(xml.PCData("hello\nworld")) the newline is there, only if you surround the PCData with XML Nodes the newline gets lost. The problem is still there in 2.9.2.

@scabug
Copy link
Author

scabug commented Dec 18, 2014

Michael Beckerle (mbeckerle.dfdl) said (edited on Dec 18, 2014 1:25:05 AM UTC):
Problem still in 2.10.4 also.

From a quick glimpse of the code. Looks like it treates all Atom subtypes similarly. It has to special case PCData and treat it specially and just output it without concern for indentation/box, etc.

@scabug
Copy link
Author

scabug commented Jul 17, 2015

@SethTisue said:
The scala-xml library is now community-maintained. Issues with it are now tracked at https://github.com/scala/scala-xml/issues instead of here in the Scala JIRA.

Interested community members: if you consider this issue significant, feel free to open a new issue for it on GitHub, with links in both directions.

@scabug scabug closed this as completed Jul 17, 2015
@scabug
Copy link
Author

scabug commented Jul 29, 2015

Michael Beckerle (mbeckerle.dfdl) said:
New issue at github: scala/scala-xml#75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant