Escape text in text nodes and attributes so we don't get errors during x...

...ml to json conversion.