import scala.xml.parsing._ import scala.io.Source object Test { val xml_good = "<![CDATA[Hello [tag]]]>" val xml_bad = "<![CDATA[Hello [tag] ]]>" val parser1 = ConstructingParser.fromSource(Source.fromString(xml_good),false) val parser2 = ConstructingParser.fromSource(Source.fromString(xml_bad),false) def main(args: Array[String]): Unit = { parser1.document parser2.document } }