-
Notifications
You must be signed in to change notification settings - Fork 21
scala.xml.Utility.trim() doesn't properly handle adjacent Text nodes #3062
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-3062?orig=1 |
@acruise said: |
@acruise said (edited on Mar 19, 2012 4:27:24 AM UTC): If there are two text nodes, should the left one be trimmed at the beginning and the right one at the end? Should singleton text nodes be trimmed at both beginning and end? |
Michael Beckerle (mbeckerle.dfdl) said (edited on May 2, 2014 1:27:22 AM UTC): @Test def testTrim() {
val a = new Text("a")
val sp = new Text(" ")
val b = new Text("b")
val data = <data>{ Seq(a, sp, b) }</data>
println(data) // prints <data>a b</data>
val trimmed = Utility.trim(data)
println(trimmed) // prints <data>ab</data> - wrong.
} You can't trim anything off anything here. |
@SethTisue said: 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. |
Michael Beckerle (mbeckerle.dfdl) said: |
if Text("My name is ") followed by Text("Harry") the space following the word "is" will be incorrectly trimmed out. Adjacent Text nodes need to be combined before whitespace is removed.
This is important when modifying XML and then trimming it. For example we might start with
The text was updated successfully, but these errors were encountered: