Adds protection agains XML injection attacks

Ben Webb reported an issue that the software might be vulnerable to
XML injection attacks. Software has been hardened against this using the
advice from:
http://phpsecurity.readthedocs.org/en/latest/Injection-Attacks.html