Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
CDATA correctness fix #39
CDATA nodes are evil. They're a hammer people use when they don't want to think about escaping. Those people will get burned, when someone types the magic sequence ]]> into a form.
This commit tests for the issue (take a look at that first, it should make clear why this is a big deal) and also fixes it.
Parsing the resulting XML will create more nodes than originally serialized. That can't be helped, unless you want to disallow creating these evil CDATA nodes in the first place.
CDATA is indeed evil. It's important to support though, if only for the sake of XHTML.
You're quite right that
val cd = CDATA(...) XML.parse(cd.toString) == cd // maybe not!
I think the better thing to do here would be to follow XML's lead and simply reject CDATA nodes which contain
In other words, we should do a quick