Removes whitespace characters, which are leftovers from previous xml
    formatting.

    :param element: an instance of lxml.etree._Element

    str.strip() is applied to the "text" and the "tail" attribute of the
    element and recursively to all child elements.

def recRemoveTreeFormating(element):
    """Removes whitespace characters, which are leftovers from previous xml
    formatting.

    :param element: an instance of lxml.etree._Element

    str.strip() is applied to the "text" and the "tail" attribute of the
    element and recursively to all child elements.
    """
    children = element.getchildren()
    if len(children) > 0:
        for child in children:
            recRemoveTreeFormating(child)
    if element.text is not None:
        if len(element.text.strip()) == 0:
            element.text = None
        else:
            element.text = element.text.strip()
    if element.tail is not None:
        if len(element.tail.strip()) == 0:
            element.tail = None
        else:
            element.tail = element.tail.strip()