Fix unicode problems with _parseXML and _writeXML in term.py
Check if Literal.value is minidom.Document instead of parsing as XML