Added tests for (un)escaping XML and fixed unescaping escaped characters

Added tests for escaping and unescaping.
And fixed the unescaping with escaped characters (if that sentence makes sense...)