def escapeXML(text):
    """Escape special characters in XML."""
    text = text.replace('&', u'\ue001')
    text = text.replace('<', '&lt;')
    text = text.replace('>', '&gt;')
    text = text.replace('"', '&quot;')
    text = text.replace("'", '&apos;')
    text = text.replace(u'\ue001', '&amp;')
    return text
