diff --git a/build.sbt b/build.sbt
index 1020608f0..81a9abcad 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,14 +1,7 @@
import com.typesafe.tools.mima.plugin.{MimaPlugin, MimaKeys}
-scalaModuleSettings
-
-name := "scala-xml"
-
-version := "1.0.6-SNAPSHOT"
-
-scalaVersion := crossScalaVersions.value.head
-
-crossScalaVersions := {
+scalaVersion in ThisBuild := crossScalaVersions.value.head
+crossScalaVersions in ThisBuild := {
val java = System.getProperty("java.version")
if (java.startsWith("1.6.") || java.startsWith("1.7."))
Seq("2.11.8")
@@ -18,27 +11,30 @@ crossScalaVersions := {
sys.error(s"don't know what Scala versions to build on $java")
}
-//reenable -Xfatal-warnings?
-scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq]
-
-scalacOptions in Test += "-Xxml:coalescing"
-
-// important!! must come here (why?)
-scalaModuleOsgiSettings
-
-OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}")
-
-libraryDependencies += "junit" % "junit" % "4.11" % "test"
-
-libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test"
-
-//// testing:
-// used in CompilerErrors test
-libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*")
-
-mimaPreviousVersion := Some("1.0.5")
-
-// You cannot disable JVM test forking when working on scala modules
-// that are distributed with the compiler because of an SBT
-// classloader leaking issue (scala/scala-xml#20 and #112).
-fork in Test := true
+lazy val root = project.in(file("."))
+ .aggregate(xmlJS, xmlJVM)
+ .settings(publish := {}, publishLocal := {})
+
+lazy val xml = crossProject.in(file("."))
+ .settings(
+ name := "scala-xml",
+ version := "1.0.6-SNAPSHOT",
+ scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq],
+ scalacOptions in Test += "-Xxml:coalescing")
+ .jvmSettings(
+ scalaModuleSettings ++
+ scalaModuleOsgiSettings ++
+ List(
+ OsgiKeys.exportPackage := Seq(s"scala.xml.*;version=${version.value}"),
+ libraryDependencies += "junit" % "junit" % "4.11" % "test",
+ libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test",
+ libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*"),
+ mimaPreviousVersion := Some("1.0.5"),
+ // You cannot disable JVM test forking when working on scala modules
+ // that are distributed with the compiler because of an SBT
+ // classloader leaking issue (scala/scala-xml#20 and #112).
+ fork in Test := true): _*)
+ .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
+
+lazy val xmlJVM = xml.jvm
+lazy val xmlJS = xml.js
diff --git a/js/src/test/scala/scala/xml/ReuseNodesTest.scala b/js/src/test/scala/scala/xml/ReuseNodesTest.scala
new file mode 100644
index 000000000..75f67efaf
--- /dev/null
+++ b/js/src/test/scala/scala/xml/ReuseNodesTest.scala
@@ -0,0 +1,58 @@
+package scala.xml
+
+import scala.xml.transform._
+import org.junit.Test
+import org.junit.Assert.assertTrue
+import org.junit.Assert.assertEquals
+import org.junit.runner.RunWith
+/**
+ * This test verify that after the tranform, the resultant xml node
+ * uses as many old nodes as possible.
+ *
+ * Three transformers class for case -
+ * One for orginal, one for modified, and one proposed which shows
+ * all are equivalent when it comes to reusing as many nodes as possible
+ */
+object ReuseNodesTest {
+
+ class OriginalTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) {
+ override def transform(ns: Seq[Node]): Seq[Node] = {
+ val xs = ns.toStream map transform
+ val (xs1, xs2) = xs zip ns span { case (x, n) => unchanged(n, x) }
+
+ if (xs2.isEmpty) ns
+ else (xs1 map (_._2)) ++ xs2.head._1 ++ transform(ns drop (xs1.length + 1))
+ }
+ override def transform(n:Node): Seq[Node] = super.transform(n)
+ }
+
+ class ModifiedTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) {
+ override def transform(ns: Seq[Node]): Seq[Node] = {
+ val changed = ns flatMap transform
+
+ if (changed.length != ns.length || (changed, ns).zipped.exists(_ != _)) changed
+ else ns
+ }
+ override def transform(n:Node): Seq[Node] = super.transform(n)
+ }
+
+ class AlternateTranformr(rules: RewriteRule*) extends RuleTransformer(rules:_*) {
+ override def transform(ns: Seq[Node]): Seq[Node] = {
+ val xs = ns.toStream map transform
+ val (xs1, xs2) = xs zip ns span { case (x, n) => unchanged(n, x) }
+
+ if (xs2.isEmpty) ns
+ else (xs1 map (_._2)) ++ xs2.head._1 ++ transform(ns drop (xs1.length + 1))
+ }
+ override def transform(n:Node): Seq[Node] = super.transform(n)
+ }
+
+ def rewriteRule = new RewriteRule {
+ override def transform(n: Node): NodeSeq = n match {
+ case n if n.label == "change" => Elem(
+ n.prefix, "changed", n.attributes, n.scope, n.child.isEmpty, n.child : _*)
+ case _ => n
+ }
+ }
+
+}
diff --git a/js/src/test/scala/scala/xml/XMLSyntaxTest.scala b/js/src/test/scala/scala/xml/XMLSyntaxTest.scala
new file mode 100644
index 000000000..da3c34c8e
--- /dev/null
+++ b/js/src/test/scala/scala/xml/XMLSyntaxTest.scala
@@ -0,0 +1,68 @@
+package scala.xml
+
+import org.junit.Test
+import org.junit.Ignore
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.Assert.assertTrue
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertEquals
+
+class XMLSyntaxTest {
+
+ private def handle[A](x: Node): A = {
+ x.child(0).asInstanceOf[Atom[A]].data
+ }
+
+ @Test
+ def test1(): Unit = {
+ val xNull = {null} // these used to be Atom(unit), changed to empty children
+ assertTrue(xNull.child sameElements Nil)
+
+ val x0 = {} // these used to be Atom(unit), changed to empty children
+ val x00 = { } // dto.
+ val xa = { "world" }
+
+ assertTrue(x0.child sameElements Nil)
+ assertTrue(x00.child sameElements Nil)
+ assertEquals("world", handle[String](xa))
+
+ val xb = { 1.5 }
+ assertEquals(1.5, handle[Double](xb), 0.0)
+
+ val xc = { 5 }
+ assertEquals(5, handle[Int](xc))
+
+ val xd = { true }
+ assertEquals(true, handle[Boolean](xd))
+
+ val xe = { 5:Short }
+ assertEquals((5:Short), handle[Short](xe))
+
+ val xf = { val x = 27; x }
+ assertEquals(27, handle[Int](xf))
+
+ val xg = { List(1,2,3,4) }
+ assertEquals("1 2 3 4", xg.toString)
+ assertFalse(xg.child.map(_.isInstanceOf[Text]).exists(identity))
+
+ val xh = { for(x <- List(1,2,3,4) if x % 2 == 0) yield x }
+ assertEquals("2 4", xh.toString)
+ assertFalse(xh.child.map(_.isInstanceOf[Text]).exists(identity))
+ }
+
+ /** see SVN r13821 (emir): support for ,
+ * so that Options can be used for optional attributes.
+ */
+ @Test
+ def test2(): Unit = {
+ val x1: Option[Seq[Node]] = Some(hello)
+ val n1 = ;
+ assertEquals(x1, n1.attribute("key"))
+
+ val x2: Option[Seq[Node]] = None
+ val n2 = ;
+ assertEquals(x2, n2.attribute("key"))
+ }
+
+}
diff --git a/js/src/test/scala/scala/xml/XMLTest.scala b/js/src/test/scala/scala/xml/XMLTest.scala
new file mode 100644
index 000000000..316517dfd
--- /dev/null
+++ b/js/src/test/scala/scala/xml/XMLTest.scala
@@ -0,0 +1,548 @@
+package scala.xml
+
+import language.postfixOps
+
+import org.junit.{Test => UnitTest}
+import org.junit.Ignore
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.junit.Assert.assertTrue
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertEquals
+// import scala.xml.parsing.ConstructingParser
+import java.io.StringWriter
+import java.io.BufferedOutputStream
+import java.io.ByteArrayOutputStream
+import java.io.StringReader
+import scala.collection.Iterable
+import scala.xml.Utility.sort
+
+object XMLTest {
+ val e: scala.xml.MetaData = Null //Node.NoAttributes
+ val sc: scala.xml.NamespaceBinding = TopScope
+}
+
+class XMLTest {
+ import XMLTest.{ e, sc }
+
+ @UnitTest
+ def nodeSeq: Unit = {
+ val p =
+
+
+
+
+
+ val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz") yield {
+ Text(x.attributes("value").toString + y.attributes("bazValue").toString + "!")
+ };
+
+ val pelems_2 = NodeSeq.fromSeq(List(Text("38!"), Text("58!")));
+ assertTrue(pelems_1 sameElements pelems_2)
+ assertTrue(Text("8") sameElements (p \\ "@bazValue"))
+ }
+
+ @UnitTest
+ def queryBooks: Unit = {
+ val books =
+
+ Blabla
+ Blubabla
+ Baaaaaaalabla
+ ;
+
+ val reviews =
+
+
+ Blabla
+
+ Hallo Welt.
+
+
+
+ Blubabla
+
+ Hello Blu
+
+
+
+ Blubabla
+
+ rem 2
+
+
+ ;
+
+ val results1 = new scala.xml.PrettyPrinter(80, 5).formatNodes(
+ for (
+ t <- books \\ "title";
+ r <- reviews \\ "entry" if (r \ "title") xml_== t
+ ) yield
+ { t }
+ { r \ "remarks" }
+ );
+ val results1Expected = """
+ | Blabla
+ | Hallo Welt.
+ |
+ | Blubabla
+ | Hello Blu
+ |
+ | Blubabla
+ | rem 2
+ |""".stripMargin
+ assertEquals(results1Expected, results1)
+
+ {
+ val actual = for (t @ Blabla <- NodeSeq.fromSeq(books.child).toList)
+ yield t
+ val expected = List(Blabla)
+ assertEquals(expected, actual)
+ }
+
+ }
+
+ @UnitTest
+ def queryPhoneBook: Unit = {
+ val phoneBook =
+
+
+ This is thephonebook
+ of the
+ ACME
+ corporation.
+
+
+ John
+ +41 21 693 68 67
+ +41 79 602 23 23
+
+ ;
+
+ val addrBook =
+
+
+ This is theaddressbook
+ of the
+ ACME
+ corporation.
+
+
+ John
+ Elm Street
+ Dolphin City
+
+ ;
+
+ val actual: String = new scala.xml.PrettyPrinter(80, 5).formatNodes(
+ for (
+ t <- addrBook \\ "entry";
+ r <- phoneBook \\ "entry" if (t \ "name") xml_== (r \ "name")
+ ) yield
+ { t.child }
+ { r \ "phone" }
+ )
+ val expected = """|
+ | John
+ | Elm Street
+ | Dolphin City
+ | +41 21 693 68 67
+ | +41 79 602 23 23
+ |""".stripMargin
+ assertEquals(expected, actual)
+ }
+
+ @UnitTest
+ def namespaces: Unit = {
+ val cuckoo =
+
+
+ ;
+ assertEquals("http://cuckoo.com", cuckoo.namespace)
+ for (n <- cuckoo \ "_") {
+ assertEquals("http://cuckoo.com", n.namespace)
+ }
+ }
+
+ @UnitTest
+ def namespacesWithNestedXmls: Unit = {
+ val foo =
+ val bar = {foo}
+ val expected = """"""
+ val actual = bar.toString
+ assertEquals(expected, actual)
+ }
+
+ @UnitTest
+ def validationOfElements: Unit = {
+ val vtor = new scala.xml.dtd.ElementValidator();
+ {
+ import scala.xml.dtd.ELEMENTS
+ import scala.xml.dtd.ContentModel._
+ vtor.setContentModel(
+ ELEMENTS(
+ Sequ(
+ Letter(ElemName("bar")),
+ Star(Letter(ElemName("baz"))))));
+ }
+ assertTrue(vtor())
+
+ {
+ import scala.xml.dtd.MIXED
+ import scala.xml.dtd.ContentModel._
+
+ vtor.setContentModel(
+ MIXED(
+ Alt(Letter(ElemName("bar")),
+ Letter(ElemName("baz")),
+ Letter(ElemName("bal")))));
+ }
+
+ assertTrue(vtor())
+ assertTrue(vtor(abcdedgh))
+ assertFalse(vtor( ))
+ }
+
+ def validationfOfAttributes: Unit = {
+ val vtor = new scala.xml.dtd.ElementValidator();
+ vtor.setContentModel(null)
+ vtor.setMetaData(List())
+ assertFalse(vtor())
+
+ {
+ import scala.xml.dtd._
+ vtor setMetaData List(AttrDecl("bar", "CDATA", IMPLIED))
+ }
+ assertFalse(vtor())
+ assertTrue(vtor())
+
+ {
+ import scala.xml.dtd._
+ vtor.setMetaData(List(AttrDecl("bar", "CDATA", REQUIRED)))
+ }
+ assertFalse(vtor())
+ assertTrue(vtor())
+ }
+
+ def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem =
+ scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*)
+
+ @UnitTest
+ def groupNode = {
+ val zx1: Node = Group { }
+ val zy1: Node = { zx1 }
+ assertEquals("", zy1.toString)
+
+ assertEquals("",
+ Group { List(, zy1, zx1) }.toString)
+
+ val zz1 =
+
+ assertTrue(zx1 xml_== zz1)
+ assertTrue(zz1.length == 3)
+ }
+
+ @UnitTest
+ def dodgyNamespace = {
+ val x =
+ assertTrue(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*"));
+ }
+
+ import NodeSeq.seqToNodeSeq
+
+ val ax =
+
+
+
+ val cx =
+ crazy text world
+
+
+ val bx =
+
+ @UnitTest
+ def XmlEx = {
+ assertTrue((ax \ "@foo") xml_== "bar") // uses NodeSeq.view!
+ assertTrue((ax \ "@foo") xml_== xml.Text("bar")) // dto.
+ assertTrue((bx \ "@foo") xml_== "bar&x") // dto.
+ assertTrue((bx \ "@foo") xml_sameElements List(xml.Text("bar&x")))
+ assertTrue("" == bx.toString)
+ }
+
+ @UnitTest
+ def XmlEy {
+ val z = ax \ "@{the namespace from outer space}foo"
+ assertTrue((ax \ "@{the namespace from outer space}foo") xml_== "baz")
+ assertTrue((cx \ "@{the namespace from outer space}foo") xml_== "baz")
+
+ try {
+ ax \ "@"
+ assertTrue(false)
+ } catch {
+ case _: IllegalArgumentException =>
+ }
+ try {
+ ax \ "@{"
+ assertTrue(false)
+ } catch {
+ case _: IllegalArgumentException =>
+ }
+ try {
+ ax \ "@{}"
+ assertTrue(false)
+ } catch {
+ case _: IllegalArgumentException =>
+ }
+
+ }
+
+ @UnitTest
+ def comment =
+ assertEquals("", toString)
+
+ @UnitTest
+ def weirdElem =
+ assertEquals("", toString)
+
+ @UnitTest
+ def escape =
+ assertEquals("""
+ "Come, come again, whoever you are, come!
+Heathen, fire worshipper or idolatrous, come!
+Come even if you broke your penitence a hundred times,
+Ours is the portal of hope, come as you are."
+ Mevlana Celaleddin Rumi""", toString) // this guy will escaped, and rightly so
+
+ @UnitTest
+ def unparsed2 = {
+ object myBreak extends scala.xml.Unparsed("
")
+ assertEquals("
", { myBreak } toString) // shows use of unparsed
+ }
+
+ @UnitTest
+ def justDontFail = {
+ match {
+ case scala.xml.QNode("gaga", "foo", md, child @ _*) =>
+ }
+
+ match {
+ case scala.xml.Node("foo", md, child @ _*) =>
+ }
+ }
+
+ def f(s: String) = {
+
+ {
+ for (item <- s split ',') yield { item }
+ }
+
+ }
+
+ @UnitTest
+ def nodeBuffer =
+ assertEquals(
+ """
+ abc
+ """, f("a,b,c") toString)
+
+ // t-486
+ def wsdlTemplate1(serviceName: String): Node =
+
+ ;
+
+ def wsdlTemplate2(serviceName: String, targetNamespace: String): Node =
+
+ ;
+
+ def wsdlTemplate3(serviceName: String): Node =
+
+ ;
+
+ def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node =
+
+ ;
+
+ @UnitTest
+ def wsdl = {
+ assertEquals("""
+ """, wsdlTemplate1("service1") toString)
+ assertEquals("""
+ """, wsdlTemplate2("service2", "target2") toString)
+ assertEquals("""
+ """, wsdlTemplate3("service3") toString)
+ assertEquals("""
+ """, wsdlTemplate4("service4", () => "target4") toString)
+ }
+
+ @UnitTest
+ def t1079 = assertFalse( == )
+
+ import dtd.{ DocType, PublicID }
+
+ @UnitTest
+ def t1620 = {
+ val dt = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", "foo.dtd"), Seq())
+ var pw = new StringWriter()
+ XML.write(pw, , "utf-8", true, dt)
+ pw.flush()
+ assertEquals("""
+
+""", pw.toString)
+
+ pw = new StringWriter()
+ val dt2 = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", null), Seq())
+ XML.write(pw, , "utf-8", true, dt2)
+ pw.flush()
+ assertEquals("""
+
+""", pw.toString)
+ }
+
+ @UnitTest
+ def t1773 = {
+ val xs = List(
+ ,
+ ,
+ { xml.NodeSeq.Empty },
+ { "" },
+ { if (true) "" else "I like turtles" })
+
+ for (x1 <- xs; x2 <- xs) assertTrue(x1 xml_== x2)
+ }
+
+ @UnitTest
+ def t3886 = {
+ assertTrue( == )
+ assertTrue( != )
+ assertTrue( != )
+
+ assertTrue( != )
+ assertTrue( != )
+ assertTrue( != )
+ }
+
+ @UnitTest
+ def t5052 {
+ assertTrue( xml_== )
+ assertTrue( xml_== )
+ assertTrue( xml_== )
+ assertTrue( xml_== )
+ }
+
+ @UnitTest
+ def t5115 = {
+ def assertHonorsIterableContract(i: Iterable[_]) = assertEquals(i.size, i.iterator.size)
+
+ assertHonorsIterableContract(.attributes)
+ assertHonorsIterableContract(.attributes)
+ assertHonorsIterableContract(.attributes)
+ assertHonorsIterableContract(.attributes)
+ assertHonorsIterableContract(.attributes)
+ assertHonorsIterableContract(.attributes)
+ assertHonorsIterableContract(.attributes)
+ assertHonorsIterableContract(.attributes)
+ }
+
+ @UnitTest
+ def t5843 {
+ val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null)
+ val bar = scala.xml.Attribute(null, "bar", "2", foo)
+ val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope)
+
+ assertEquals(""" foo="1"""", foo toString)
+ assertEquals(null, scala.xml.TopScope.getURI(foo.pre))
+ assertEquals(""" bar="2"""", bar remove "foo" toString)
+ assertEquals(""" foo="1"""", bar remove "bar" toString)
+ assertEquals(""" bar="2"""", bar remove (null, scala.xml.TopScope, "foo") toString)
+ assertEquals(""" foo="1"""", bar remove (null, scala.xml.TopScope, "bar") toString)
+ assertEquals(""" bar="2" foo="1"""", bar toString)
+ assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "foo") toString)
+ assertEquals(""" bar="2" foo="1"""", bar remove (null, ns, "bar") toString)
+ }
+
+ @UnitTest
+ def t7074 {
+ assertEquals("""""", sort() toString)
+ assertEquals("""""", sort() toString)
+ assertEquals("""""", sort() toString)
+ assertEquals("""""", sort() toString)
+ assertEquals("""""", sort() toString)
+ assertEquals("""""", sort() toString)
+ assertEquals("""""", sort() toString)
+ assertEquals("""""", sort() toString)
+ assertEquals("""""", sort() toString)
+ }
+
+ @UnitTest
+ def attributes = {
+ val noAttr =
+ val attrNull =
+ val attrNone =
+ val preAttrNull =
+ val preAttrNone =
+ assertEquals(noAttr, attrNull)
+ assertEquals(noAttr, attrNone)
+ assertEquals(noAttr, preAttrNull)
+ assertEquals(noAttr, preAttrNone)
+
+ val xml1 =
+ val xml2 =
+ val xml3 =
+ assertEquals(xml1, xml2)
+ assertEquals(xml1, xml3)
+
+ assertEquals("""""", noAttr toString)
+ assertEquals("""""", attrNull toString)
+ assertEquals("""""", attrNone toString)
+ assertEquals("""""", preAttrNull toString)
+ assertEquals("""""", preAttrNone toString)
+ assertEquals("""""", xml1 toString)
+ assertEquals("""""", xml2 toString)
+ assertEquals("""""", xml3 toString)
+
+ // Check if attribute order is retained
+ assertEquals("""""", toString)
+ assertEquals("""""", toString)
+ assertEquals("""""", toString)
+ assertEquals("""""", toString)
+ }
+
+ @UnitTest
+ def issue28: Unit = {
+ val x =
+ // val ns = new NamespaceBinding("x", "gaga", sc)
+ // val x = Elem("x", "foo", e, ns)
+ val pp = new xml.PrettyPrinter(80, 2)
+ // This assertion passed
+ assertEquals("""""", x.toString)
+ // This was the bug, producing an errant xmlns attribute
+ assertEquals("""""", pp.format(x))
+ }
+
+ @UnitTest
+ def nodeSeqNs: Unit = {
+ val x = {
+
+ }
+ val pp = new PrettyPrinter(80, 2)
+ val expected = """"""
+ assertEquals(expected, pp.formatNodes(x))
+ }
+
+ @UnitTest
+ def nodeStringBuilder: Unit = {
+ val x = {
+
+ }
+ val pp = new PrettyPrinter(80, 2)
+ val expected = """"""
+ val sb = new StringBuilder
+ pp.format(x, sb)
+ assertEquals(expected, sb.toString)
+ }
+}
diff --git a/js/src/test/scala/scala/xml/parsing/PiParsingTest.scala b/js/src/test/scala/scala/xml/parsing/PiParsingTest.scala
new file mode 100644
index 000000000..fedf38dc5
--- /dev/null
+++ b/js/src/test/scala/scala/xml/parsing/PiParsingTest.scala
@@ -0,0 +1,28 @@
+package scala.xml.parsing
+
+import org.junit.Test
+import org.junit.Ignore
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import scala.xml.JUnitAssertsForXML.assertEquals
+
+class PiParsingTest {
+
+
+ import scala.io.Source.fromString
+ import scala.xml.TopScope
+
+ @Test
+ def piNoWSLiteral: Unit = {
+ val expected = "ab"
+ assertEquals(expected, ab)
+ }
+
+
+ @Test
+ def piLiteral: Unit = {
+ val expected = " a b "
+ assertEquals(expected, a b )
+ }
+
+}
diff --git a/js/src/test/scala/scala/xml/parsing/Ticket0632Test.scala b/js/src/test/scala/scala/xml/parsing/Ticket0632Test.scala
new file mode 100644
index 000000000..8b939118a
--- /dev/null
+++ b/js/src/test/scala/scala/xml/parsing/Ticket0632Test.scala
@@ -0,0 +1,35 @@
+package scala.xml.parsing
+
+import org.junit.Test
+import org.junit.Ignore
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import scala.xml.JUnitAssertsForXML.assertEquals
+
+class Ticket0632Test {
+
+ import scala.io.Source.fromString
+ import scala.xml.{NodeSeq, TopScope}
+
+ @Test
+ def singleAmp: Unit = {
+ val expected = ""
+ assertEquals(expected, )
+ assertEquals(expected, )
+ }
+
+ @Test
+ def oneAndHalfAmp: Unit = {
+ val expected = ""
+ assertEquals(expected, )
+ assertEquals(expected, )
+ }
+
+ @Test
+ def doubleAmp: Unit = {
+ val expected = ""
+ assertEquals(expected, )
+ assertEquals(expected, )
+ }
+
+}
diff --git a/js/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/js/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala
new file mode 100644
index 000000000..6cfd4e872
--- /dev/null
+++ b/js/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala
@@ -0,0 +1,19 @@
+package scala.xml
+package pull
+
+import org.junit.Test
+import org.junit.Assert.{assertFalse, assertTrue}
+
+import scala.io.Source
+import scala.xml.parsing.FatalError
+
+class XMLEventReaderTest {
+
+ val src = Source.fromString("!")
+
+ private def toSource(s: String) = new Source {
+ val iter = s.iterator
+ override def reportError(pos: Int, msg: String, out: java.io.PrintStream = Console.err) {}
+ }
+
+}
diff --git a/src/test/scala/scala/xml/CompilerErrors.scala b/jvm/src/test/scala/scala/xml/CompilerErrors.scala
similarity index 100%
rename from src/test/scala/scala/xml/CompilerErrors.scala
rename to jvm/src/test/scala/scala/xml/CompilerErrors.scala
diff --git a/src/test/scala/scala/xml/ReuseNodesTest.scala b/jvm/src/test/scala/scala/xml/ReuseNodesTest.scala
similarity index 100%
rename from src/test/scala/scala/xml/ReuseNodesTest.scala
rename to jvm/src/test/scala/scala/xml/ReuseNodesTest.scala
diff --git a/src/test/scala/scala/xml/XMLSyntaxTest.scala b/jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala
similarity index 100%
rename from src/test/scala/scala/xml/XMLSyntaxTest.scala
rename to jvm/src/test/scala/scala/xml/XMLSyntaxTest.scala
diff --git a/src/test/scala/scala/xml/XMLTest.scala b/jvm/src/test/scala/scala/xml/XMLTest.scala
similarity index 100%
rename from src/test/scala/scala/xml/XMLTest.scala
rename to jvm/src/test/scala/scala/xml/XMLTest.scala
diff --git a/src/test/scala/scala/xml/parsing/PiParsingTest.scala b/jvm/src/test/scala/scala/xml/parsing/PiParsingTest.scala
similarity index 100%
rename from src/test/scala/scala/xml/parsing/PiParsingTest.scala
rename to jvm/src/test/scala/scala/xml/parsing/PiParsingTest.scala
diff --git a/src/test/scala/scala/xml/parsing/Ticket0632Test.scala b/jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala
similarity index 100%
rename from src/test/scala/scala/xml/parsing/Ticket0632Test.scala
rename to jvm/src/test/scala/scala/xml/parsing/Ticket0632Test.scala
diff --git a/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala b/jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala
similarity index 100%
rename from src/test/scala/scala/xml/pull/XMLEventReaderTest.scala
rename to jvm/src/test/scala/scala/xml/pull/XMLEventReaderTest.scala
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 65dea32cf..02f25173e 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1 +1,4 @@
addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.4")
+
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.12")
+
diff --git a/src/main/scala/scala/xml/Atom.scala b/shared/src/main/scala/scala/xml/Atom.scala
similarity index 100%
rename from src/main/scala/scala/xml/Atom.scala
rename to shared/src/main/scala/scala/xml/Atom.scala
diff --git a/src/main/scala/scala/xml/Attribute.scala b/shared/src/main/scala/scala/xml/Attribute.scala
similarity index 100%
rename from src/main/scala/scala/xml/Attribute.scala
rename to shared/src/main/scala/scala/xml/Attribute.scala
diff --git a/src/main/scala/scala/xml/Comment.scala b/shared/src/main/scala/scala/xml/Comment.scala
similarity index 100%
rename from src/main/scala/scala/xml/Comment.scala
rename to shared/src/main/scala/scala/xml/Comment.scala
diff --git a/src/main/scala/scala/xml/Document.scala b/shared/src/main/scala/scala/xml/Document.scala
similarity index 100%
rename from src/main/scala/scala/xml/Document.scala
rename to shared/src/main/scala/scala/xml/Document.scala
diff --git a/src/main/scala/scala/xml/Elem.scala b/shared/src/main/scala/scala/xml/Elem.scala
similarity index 100%
rename from src/main/scala/scala/xml/Elem.scala
rename to shared/src/main/scala/scala/xml/Elem.scala
diff --git a/src/main/scala/scala/xml/EntityRef.scala b/shared/src/main/scala/scala/xml/EntityRef.scala
similarity index 100%
rename from src/main/scala/scala/xml/EntityRef.scala
rename to shared/src/main/scala/scala/xml/EntityRef.scala
diff --git a/src/main/scala/scala/xml/Equality.scala b/shared/src/main/scala/scala/xml/Equality.scala
similarity index 100%
rename from src/main/scala/scala/xml/Equality.scala
rename to shared/src/main/scala/scala/xml/Equality.scala
diff --git a/src/main/scala/scala/xml/Group.scala b/shared/src/main/scala/scala/xml/Group.scala
similarity index 100%
rename from src/main/scala/scala/xml/Group.scala
rename to shared/src/main/scala/scala/xml/Group.scala
diff --git a/src/main/scala/scala/xml/MalformedAttributeException.scala b/shared/src/main/scala/scala/xml/MalformedAttributeException.scala
similarity index 100%
rename from src/main/scala/scala/xml/MalformedAttributeException.scala
rename to shared/src/main/scala/scala/xml/MalformedAttributeException.scala
diff --git a/src/main/scala/scala/xml/MetaData.scala b/shared/src/main/scala/scala/xml/MetaData.scala
similarity index 100%
rename from src/main/scala/scala/xml/MetaData.scala
rename to shared/src/main/scala/scala/xml/MetaData.scala
diff --git a/src/main/scala/scala/xml/NamespaceBinding.scala b/shared/src/main/scala/scala/xml/NamespaceBinding.scala
similarity index 100%
rename from src/main/scala/scala/xml/NamespaceBinding.scala
rename to shared/src/main/scala/scala/xml/NamespaceBinding.scala
diff --git a/src/main/scala/scala/xml/Node.scala b/shared/src/main/scala/scala/xml/Node.scala
similarity index 100%
rename from src/main/scala/scala/xml/Node.scala
rename to shared/src/main/scala/scala/xml/Node.scala
diff --git a/src/main/scala/scala/xml/NodeBuffer.scala b/shared/src/main/scala/scala/xml/NodeBuffer.scala
similarity index 100%
rename from src/main/scala/scala/xml/NodeBuffer.scala
rename to shared/src/main/scala/scala/xml/NodeBuffer.scala
diff --git a/src/main/scala/scala/xml/NodeSeq.scala b/shared/src/main/scala/scala/xml/NodeSeq.scala
similarity index 100%
rename from src/main/scala/scala/xml/NodeSeq.scala
rename to shared/src/main/scala/scala/xml/NodeSeq.scala
diff --git a/src/main/scala/scala/xml/Null.scala b/shared/src/main/scala/scala/xml/Null.scala
similarity index 100%
rename from src/main/scala/scala/xml/Null.scala
rename to shared/src/main/scala/scala/xml/Null.scala
diff --git a/src/main/scala/scala/xml/PCData.scala b/shared/src/main/scala/scala/xml/PCData.scala
similarity index 100%
rename from src/main/scala/scala/xml/PCData.scala
rename to shared/src/main/scala/scala/xml/PCData.scala
diff --git a/src/main/scala/scala/xml/PrefixedAttribute.scala b/shared/src/main/scala/scala/xml/PrefixedAttribute.scala
similarity index 100%
rename from src/main/scala/scala/xml/PrefixedAttribute.scala
rename to shared/src/main/scala/scala/xml/PrefixedAttribute.scala
diff --git a/src/main/scala/scala/xml/PrettyPrinter.scala b/shared/src/main/scala/scala/xml/PrettyPrinter.scala
similarity index 100%
rename from src/main/scala/scala/xml/PrettyPrinter.scala
rename to shared/src/main/scala/scala/xml/PrettyPrinter.scala
diff --git a/src/main/scala/scala/xml/ProcInstr.scala b/shared/src/main/scala/scala/xml/ProcInstr.scala
similarity index 100%
rename from src/main/scala/scala/xml/ProcInstr.scala
rename to shared/src/main/scala/scala/xml/ProcInstr.scala
diff --git a/src/main/scala/scala/xml/QNode.scala b/shared/src/main/scala/scala/xml/QNode.scala
similarity index 100%
rename from src/main/scala/scala/xml/QNode.scala
rename to shared/src/main/scala/scala/xml/QNode.scala
diff --git a/src/main/scala/scala/xml/SpecialNode.scala b/shared/src/main/scala/scala/xml/SpecialNode.scala
similarity index 100%
rename from src/main/scala/scala/xml/SpecialNode.scala
rename to shared/src/main/scala/scala/xml/SpecialNode.scala
diff --git a/src/main/scala/scala/xml/Text.scala b/shared/src/main/scala/scala/xml/Text.scala
similarity index 100%
rename from src/main/scala/scala/xml/Text.scala
rename to shared/src/main/scala/scala/xml/Text.scala
diff --git a/src/main/scala/scala/xml/TextBuffer.scala b/shared/src/main/scala/scala/xml/TextBuffer.scala
similarity index 100%
rename from src/main/scala/scala/xml/TextBuffer.scala
rename to shared/src/main/scala/scala/xml/TextBuffer.scala
diff --git a/src/main/scala/scala/xml/TopScope.scala b/shared/src/main/scala/scala/xml/TopScope.scala
similarity index 100%
rename from src/main/scala/scala/xml/TopScope.scala
rename to shared/src/main/scala/scala/xml/TopScope.scala
diff --git a/src/main/scala/scala/xml/TypeSymbol.scala b/shared/src/main/scala/scala/xml/TypeSymbol.scala
similarity index 100%
rename from src/main/scala/scala/xml/TypeSymbol.scala
rename to shared/src/main/scala/scala/xml/TypeSymbol.scala
diff --git a/src/main/scala/scala/xml/Unparsed.scala b/shared/src/main/scala/scala/xml/Unparsed.scala
similarity index 100%
rename from src/main/scala/scala/xml/Unparsed.scala
rename to shared/src/main/scala/scala/xml/Unparsed.scala
diff --git a/src/main/scala/scala/xml/UnprefixedAttribute.scala b/shared/src/main/scala/scala/xml/UnprefixedAttribute.scala
similarity index 100%
rename from src/main/scala/scala/xml/UnprefixedAttribute.scala
rename to shared/src/main/scala/scala/xml/UnprefixedAttribute.scala
diff --git a/src/main/scala/scala/xml/Utility.scala b/shared/src/main/scala/scala/xml/Utility.scala
similarity index 100%
rename from src/main/scala/scala/xml/Utility.scala
rename to shared/src/main/scala/scala/xml/Utility.scala
diff --git a/src/main/scala/scala/xml/XML.scala b/shared/src/main/scala/scala/xml/XML.scala
similarity index 100%
rename from src/main/scala/scala/xml/XML.scala
rename to shared/src/main/scala/scala/xml/XML.scala
diff --git a/src/main/scala/scala/xml/Xhtml.scala b/shared/src/main/scala/scala/xml/Xhtml.scala
similarity index 100%
rename from src/main/scala/scala/xml/Xhtml.scala
rename to shared/src/main/scala/scala/xml/Xhtml.scala
diff --git a/src/main/scala/scala/xml/dtd/ContentModel.scala b/shared/src/main/scala/scala/xml/dtd/ContentModel.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/ContentModel.scala
rename to shared/src/main/scala/scala/xml/dtd/ContentModel.scala
diff --git a/src/main/scala/scala/xml/dtd/ContentModelParser.scala b/shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/ContentModelParser.scala
rename to shared/src/main/scala/scala/xml/dtd/ContentModelParser.scala
diff --git a/src/main/scala/scala/xml/dtd/DTD.scala b/shared/src/main/scala/scala/xml/dtd/DTD.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/DTD.scala
rename to shared/src/main/scala/scala/xml/dtd/DTD.scala
diff --git a/src/main/scala/scala/xml/dtd/Decl.scala b/shared/src/main/scala/scala/xml/dtd/Decl.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/Decl.scala
rename to shared/src/main/scala/scala/xml/dtd/Decl.scala
diff --git a/src/main/scala/scala/xml/dtd/DocType.scala b/shared/src/main/scala/scala/xml/dtd/DocType.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/DocType.scala
rename to shared/src/main/scala/scala/xml/dtd/DocType.scala
diff --git a/src/main/scala/scala/xml/dtd/ElementValidator.scala b/shared/src/main/scala/scala/xml/dtd/ElementValidator.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/ElementValidator.scala
rename to shared/src/main/scala/scala/xml/dtd/ElementValidator.scala
diff --git a/src/main/scala/scala/xml/dtd/ExternalID.scala b/shared/src/main/scala/scala/xml/dtd/ExternalID.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/ExternalID.scala
rename to shared/src/main/scala/scala/xml/dtd/ExternalID.scala
diff --git a/src/main/scala/scala/xml/dtd/Scanner.scala b/shared/src/main/scala/scala/xml/dtd/Scanner.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/Scanner.scala
rename to shared/src/main/scala/scala/xml/dtd/Scanner.scala
diff --git a/src/main/scala/scala/xml/dtd/Tokens.scala b/shared/src/main/scala/scala/xml/dtd/Tokens.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/Tokens.scala
rename to shared/src/main/scala/scala/xml/dtd/Tokens.scala
diff --git a/src/main/scala/scala/xml/dtd/ValidationException.scala b/shared/src/main/scala/scala/xml/dtd/ValidationException.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/ValidationException.scala
rename to shared/src/main/scala/scala/xml/dtd/ValidationException.scala
diff --git a/src/main/scala/scala/xml/dtd/impl/Base.scala b/shared/src/main/scala/scala/xml/dtd/impl/Base.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/impl/Base.scala
rename to shared/src/main/scala/scala/xml/dtd/impl/Base.scala
diff --git a/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala
rename to shared/src/main/scala/scala/xml/dtd/impl/BaseBerrySethi.scala
diff --git a/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala
rename to shared/src/main/scala/scala/xml/dtd/impl/DetWordAutom.scala
diff --git a/src/main/scala/scala/xml/dtd/impl/Inclusion.scala b/shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/impl/Inclusion.scala
rename to shared/src/main/scala/scala/xml/dtd/impl/Inclusion.scala
diff --git a/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala b/shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala
rename to shared/src/main/scala/scala/xml/dtd/impl/NondetWordAutom.scala
diff --git a/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala
rename to shared/src/main/scala/scala/xml/dtd/impl/PointedHedgeExp.scala
diff --git a/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala b/shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala
rename to shared/src/main/scala/scala/xml/dtd/impl/SubsetConstruction.scala
diff --git a/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala b/shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/impl/SyntaxError.scala
rename to shared/src/main/scala/scala/xml/dtd/impl/SyntaxError.scala
diff --git a/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala
rename to shared/src/main/scala/scala/xml/dtd/impl/WordBerrySethi.scala
diff --git a/src/main/scala/scala/xml/dtd/impl/WordExp.scala b/shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala
similarity index 100%
rename from src/main/scala/scala/xml/dtd/impl/WordExp.scala
rename to shared/src/main/scala/scala/xml/dtd/impl/WordExp.scala
diff --git a/src/main/scala/scala/xml/factory/Binder.scala b/shared/src/main/scala/scala/xml/factory/Binder.scala
similarity index 100%
rename from src/main/scala/scala/xml/factory/Binder.scala
rename to shared/src/main/scala/scala/xml/factory/Binder.scala
diff --git a/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala b/shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala
similarity index 100%
rename from src/main/scala/scala/xml/factory/LoggedNodeFactory.scala
rename to shared/src/main/scala/scala/xml/factory/LoggedNodeFactory.scala
diff --git a/src/main/scala/scala/xml/factory/NodeFactory.scala b/shared/src/main/scala/scala/xml/factory/NodeFactory.scala
similarity index 100%
rename from src/main/scala/scala/xml/factory/NodeFactory.scala
rename to shared/src/main/scala/scala/xml/factory/NodeFactory.scala
diff --git a/src/main/scala/scala/xml/factory/XMLLoader.scala b/shared/src/main/scala/scala/xml/factory/XMLLoader.scala
similarity index 100%
rename from src/main/scala/scala/xml/factory/XMLLoader.scala
rename to shared/src/main/scala/scala/xml/factory/XMLLoader.scala
diff --git a/src/main/scala/scala/xml/include/CircularIncludeException.scala b/shared/src/main/scala/scala/xml/include/CircularIncludeException.scala
similarity index 100%
rename from src/main/scala/scala/xml/include/CircularIncludeException.scala
rename to shared/src/main/scala/scala/xml/include/CircularIncludeException.scala
diff --git a/src/main/scala/scala/xml/include/UnavailableResourceException.scala b/shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala
similarity index 100%
rename from src/main/scala/scala/xml/include/UnavailableResourceException.scala
rename to shared/src/main/scala/scala/xml/include/UnavailableResourceException.scala
diff --git a/src/main/scala/scala/xml/include/XIncludeException.scala b/shared/src/main/scala/scala/xml/include/XIncludeException.scala
similarity index 100%
rename from src/main/scala/scala/xml/include/XIncludeException.scala
rename to shared/src/main/scala/scala/xml/include/XIncludeException.scala
diff --git a/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala b/shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala
similarity index 100%
rename from src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala
rename to shared/src/main/scala/scala/xml/include/sax/EncodingHeuristics.scala
diff --git a/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala b/shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala
similarity index 100%
rename from src/main/scala/scala/xml/include/sax/XIncludeFilter.scala
rename to shared/src/main/scala/scala/xml/include/sax/XIncludeFilter.scala
diff --git a/src/main/scala/scala/xml/include/sax/XIncluder.scala b/shared/src/main/scala/scala/xml/include/sax/XIncluder.scala
similarity index 100%
rename from src/main/scala/scala/xml/include/sax/XIncluder.scala
rename to shared/src/main/scala/scala/xml/include/sax/XIncluder.scala
diff --git a/src/main/scala/scala/xml/package.scala b/shared/src/main/scala/scala/xml/package.scala
similarity index 100%
rename from src/main/scala/scala/xml/package.scala
rename to shared/src/main/scala/scala/xml/package.scala
diff --git a/src/main/scala/scala/xml/parsing/ConstructingHandler.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/ConstructingHandler.scala
rename to shared/src/main/scala/scala/xml/parsing/ConstructingHandler.scala
diff --git a/src/main/scala/scala/xml/parsing/ConstructingParser.scala b/shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/ConstructingParser.scala
rename to shared/src/main/scala/scala/xml/parsing/ConstructingParser.scala
diff --git a/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala
rename to shared/src/main/scala/scala/xml/parsing/DefaultMarkupHandler.scala
diff --git a/src/main/scala/scala/xml/parsing/ExternalSources.scala b/shared/src/main/scala/scala/xml/parsing/ExternalSources.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/ExternalSources.scala
rename to shared/src/main/scala/scala/xml/parsing/ExternalSources.scala
diff --git a/src/main/scala/scala/xml/parsing/FactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/FactoryAdapter.scala
rename to shared/src/main/scala/scala/xml/parsing/FactoryAdapter.scala
diff --git a/src/main/scala/scala/xml/parsing/FatalError.scala b/shared/src/main/scala/scala/xml/parsing/FatalError.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/FatalError.scala
rename to shared/src/main/scala/scala/xml/parsing/FatalError.scala
diff --git a/src/main/scala/scala/xml/parsing/MarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/MarkupHandler.scala
rename to shared/src/main/scala/scala/xml/parsing/MarkupHandler.scala
diff --git a/src/main/scala/scala/xml/parsing/MarkupParser.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParser.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/MarkupParser.scala
rename to shared/src/main/scala/scala/xml/parsing/MarkupParser.scala
diff --git a/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala b/shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/MarkupParserCommon.scala
rename to shared/src/main/scala/scala/xml/parsing/MarkupParserCommon.scala
diff --git a/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala b/shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala
rename to shared/src/main/scala/scala/xml/parsing/NoBindingFactoryAdapter.scala
diff --git a/src/main/scala/scala/xml/parsing/TokenTests.scala b/shared/src/main/scala/scala/xml/parsing/TokenTests.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/TokenTests.scala
rename to shared/src/main/scala/scala/xml/parsing/TokenTests.scala
diff --git a/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala b/shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala
rename to shared/src/main/scala/scala/xml/parsing/ValidatingMarkupHandler.scala
diff --git a/src/main/scala/scala/xml/parsing/XhtmlEntities.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/XhtmlEntities.scala
rename to shared/src/main/scala/scala/xml/parsing/XhtmlEntities.scala
diff --git a/src/main/scala/scala/xml/parsing/XhtmlParser.scala b/shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala
similarity index 100%
rename from src/main/scala/scala/xml/parsing/XhtmlParser.scala
rename to shared/src/main/scala/scala/xml/parsing/XhtmlParser.scala
diff --git a/src/main/scala/scala/xml/persistent/CachedFileStorage.scala b/shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala
similarity index 100%
rename from src/main/scala/scala/xml/persistent/CachedFileStorage.scala
rename to shared/src/main/scala/scala/xml/persistent/CachedFileStorage.scala
diff --git a/src/main/scala/scala/xml/persistent/Index.scala b/shared/src/main/scala/scala/xml/persistent/Index.scala
similarity index 100%
rename from src/main/scala/scala/xml/persistent/Index.scala
rename to shared/src/main/scala/scala/xml/persistent/Index.scala
diff --git a/src/main/scala/scala/xml/persistent/SetStorage.scala b/shared/src/main/scala/scala/xml/persistent/SetStorage.scala
similarity index 100%
rename from src/main/scala/scala/xml/persistent/SetStorage.scala
rename to shared/src/main/scala/scala/xml/persistent/SetStorage.scala
diff --git a/src/main/scala/scala/xml/pull/XMLEvent.scala b/shared/src/main/scala/scala/xml/pull/XMLEvent.scala
similarity index 100%
rename from src/main/scala/scala/xml/pull/XMLEvent.scala
rename to shared/src/main/scala/scala/xml/pull/XMLEvent.scala
diff --git a/src/main/scala/scala/xml/pull/XMLEventReader.scala b/shared/src/main/scala/scala/xml/pull/XMLEventReader.scala
similarity index 100%
rename from src/main/scala/scala/xml/pull/XMLEventReader.scala
rename to shared/src/main/scala/scala/xml/pull/XMLEventReader.scala
diff --git a/src/main/scala/scala/xml/pull/package.scala b/shared/src/main/scala/scala/xml/pull/package.scala
similarity index 100%
rename from src/main/scala/scala/xml/pull/package.scala
rename to shared/src/main/scala/scala/xml/pull/package.scala
diff --git a/src/main/scala/scala/xml/transform/BasicTransformer.scala b/shared/src/main/scala/scala/xml/transform/BasicTransformer.scala
similarity index 100%
rename from src/main/scala/scala/xml/transform/BasicTransformer.scala
rename to shared/src/main/scala/scala/xml/transform/BasicTransformer.scala
diff --git a/src/main/scala/scala/xml/transform/RewriteRule.scala b/shared/src/main/scala/scala/xml/transform/RewriteRule.scala
similarity index 100%
rename from src/main/scala/scala/xml/transform/RewriteRule.scala
rename to shared/src/main/scala/scala/xml/transform/RewriteRule.scala
diff --git a/src/main/scala/scala/xml/transform/RuleTransformer.scala b/shared/src/main/scala/scala/xml/transform/RuleTransformer.scala
similarity index 100%
rename from src/main/scala/scala/xml/transform/RuleTransformer.scala
rename to shared/src/main/scala/scala/xml/transform/RuleTransformer.scala
diff --git a/src/test/scala/scala/xml/AttributeTest.scala b/shared/src/test/scala/scala/xml/AttributeTest.scala
similarity index 100%
rename from src/test/scala/scala/xml/AttributeTest.scala
rename to shared/src/test/scala/scala/xml/AttributeTest.scala
diff --git a/src/test/scala/scala/xml/JUnitAssertsForXML.scala b/shared/src/test/scala/scala/xml/JUnitAssertsForXML.scala
similarity index 100%
rename from src/test/scala/scala/xml/JUnitAssertsForXML.scala
rename to shared/src/test/scala/scala/xml/JUnitAssertsForXML.scala
diff --git a/src/test/scala/scala/xml/MetaDataTest.scala b/shared/src/test/scala/scala/xml/MetaDataTest.scala
similarity index 100%
rename from src/test/scala/scala/xml/MetaDataTest.scala
rename to shared/src/test/scala/scala/xml/MetaDataTest.scala
diff --git a/src/test/scala/scala/xml/PatternMatching.scala b/shared/src/test/scala/scala/xml/PatternMatching.scala
similarity index 100%
rename from src/test/scala/scala/xml/PatternMatching.scala
rename to shared/src/test/scala/scala/xml/PatternMatching.scala
diff --git a/src/test/scala/scala/xml/PrintEmptyElementsTest.scala b/shared/src/test/scala/scala/xml/PrintEmptyElementsTest.scala
similarity index 100%
rename from src/test/scala/scala/xml/PrintEmptyElementsTest.scala
rename to shared/src/test/scala/scala/xml/PrintEmptyElementsTest.scala
diff --git a/src/test/scala/scala/xml/ShouldCompile.scala b/shared/src/test/scala/scala/xml/ShouldCompile.scala
similarity index 100%
rename from src/test/scala/scala/xml/ShouldCompile.scala
rename to shared/src/test/scala/scala/xml/ShouldCompile.scala
diff --git a/src/test/scala/scala/xml/Transformers.scala b/shared/src/test/scala/scala/xml/Transformers.scala
similarity index 100%
rename from src/test/scala/scala/xml/Transformers.scala
rename to shared/src/test/scala/scala/xml/Transformers.scala
diff --git a/src/test/scala/scala/xml/UtilityTest.scala b/shared/src/test/scala/scala/xml/UtilityTest.scala
similarity index 100%
rename from src/test/scala/scala/xml/UtilityTest.scala
rename to shared/src/test/scala/scala/xml/UtilityTest.scala
diff --git a/src/test/scala/scala/xml/XMLEmbeddingTest.scala b/shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala
similarity index 100%
rename from src/test/scala/scala/xml/XMLEmbeddingTest.scala
rename to shared/src/test/scala/scala/xml/XMLEmbeddingTest.scala