ERROR: The referenced entity has not been defined.

I received the following today when uploading a large XML file via proc metadata:

ERROR: The referenced entity has not been defined.

All my entities had been appropriately escaped (or so I thought):

select (instr);
  whe...