validate custom data to prevent submission errors

http://manage.dimagi.com/default.asp?142187
That's unlikely but even if it does its not too serious since the main point here is to avoid submission errors caused by invalid XML.