def escapeXMLChars(text):
    """Controls characters that need to be escaped (to obtain a well-formed
    XML document)

    Args:
        text: The text that will be escaped (string)

    Returns:
        text: new text containing XML entities instead of characters (string)
    """
    text = text.replace("&", "&amp;")
    #text = text.replace("\"", "&quot;")
    #text = text.replace("'", "&apos;")
    text = text.replace("<", "&lt;")
    #text = text.replace(">", "&gt;")
    return text