summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-10-04 21:33:31 +0000
committerPaul Phillips <paulp@improving.org>2011-10-04 21:33:31 +0000
commitea562b4177eee9f8a00ac9005b7a786d7370563e (patch)
tree0078a3e0cda288a2b38c463e66f6ad81abdfa9f3
parent10938bfc062511bbb19fe697235332e0e303ceab (diff)
downloadscala-ea562b4177eee9f8a00ac9005b7a786d7370563e.tar.gz
scala-ea562b4177eee9f8a00ac9005b7a786d7370563e.tar.bz2
scala-ea562b4177eee9f8a00ac9005b7a786d7370563e.zip
Restores XML entity fix.
Did something eat some whitespace? I don't know. This is almost the same commit as r25783, but with different whitespace. No review.
-rw-r--r--src/library/scala/xml/Utility.scala8
-rw-r--r--test/files/jvm/xml05.check11
-rw-r--r--test/files/jvm/xml05.scala7
3 files changed, 22 insertions, 4 deletions
diff --git a/src/library/scala/xml/Utility.scala b/src/library/scala/xml/Utility.scala
index 4d6712419c..9f230a7866 100644
--- a/src/library/scala/xml/Utility.scala
+++ b/src/library/scala/xml/Utility.scala
@@ -364,14 +364,14 @@ object Utility extends AnyRef with parsing.TokenTests {
c = it.next
}
val ref = rfb.toString()
- rfb.setLength(0)
+ rfb.clear()
unescape(ref,sb) match {
case null =>
- if (sb.length > 0) { // flush buffer
+ if (sb.length > 0) { // flush buffer
nb += Text(sb.toString())
- sb.setLength(0)
+ sb.clear()
}
- nb += EntityRef(sb.toString()) // add entityref
+ nb += EntityRef(ref) // add entityref
case _ =>
}
}
diff --git a/test/files/jvm/xml05.check b/test/files/jvm/xml05.check
new file mode 100644
index 0000000000..00e617c578
--- /dev/null
+++ b/test/files/jvm/xml05.check
@@ -0,0 +1,11 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> <city name="San Jos&eacute;"/>
+res0: scala.xml.Elem = <city name="San Jos&eacute;"></city>
+
+scala>
+
+scala>
diff --git a/test/files/jvm/xml05.scala b/test/files/jvm/xml05.scala
new file mode 100644
index 0000000000..52ae255393
--- /dev/null
+++ b/test/files/jvm/xml05.scala
@@ -0,0 +1,7 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+<city name="San Jos&eacute;"/>
+ """
+} \ No newline at end of file