@staticmethod
def strip(elem):
    """
        Removes extra whitespace between xml elements and within the text.

        :param elem: the root element to remove the whitespace between and its children.
        :type elem: Element
        """
    for elem in elem.iter():
        if elem.text:
            elem.text = elem.text.strip()
        if elem.tail:
            elem.tail = elem.tail.strip()
