Since it's just text being imported, it should be fairly easy to escape the text data with something like:
Code:
from xml.sax.saxutils import escape as xmlescape
.
.
.
data = xmlescape(data)
... somewhere in the plugin after the text file is read in. That should take care of ampersands and angle brackets.