ORA-31011: XML parsing failed LPX-00217: invalid character error can be a bug
If you get the error below:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00217: invalid character
from code running on Oracle 18.104.22.168 and 22.214.171.124 and it used to work on previous versions then stop and check MOS 1391688.1. It can save you a lot of time. The reason you get this error can be bug 11877267.
I hit this bug on Oracle 126.96.36.199 during investigation why a PL/SQL piece of code that parses XMLTYPE was not working. The reason is the new XML parser introduced with 188.8.131.52.
You can either apply patch 11877267 or use the workaround to set back the old XML parser as of version 184.108.40.206.
alter system set event=’31156 trace name context forever, level 0x400′ scope=spfile;