def xml_elements_equal(e1, e2):
    """
    Compare 2 XML elements by content.
    :param e1: first XML element
    :param e2: second XML element
    :return: True if two xml elements are the same by content
    """
    if e1.tag != e2.tag:
        return False
    if e1.text != e2.text:
        return False
    if e1.tail != e2.tail:
        return False
    if e1.attrib != e2.attrib:
        return False
    if len(e1) != len(e2):
        return False
    return all(xml_elements_equal(c1, c2) for c1, c2 in zip(e1, e2))