Skip to content

Commit

Permalink
Add function to check for empty element
Browse files Browse the repository at this point in the history
  • Loading branch information
kthoden committed Jul 9, 2021
1 parent 6d05feb commit b9786df
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/utils/libeoaconvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,21 @@ def transfer_xml_attributes(old_element_attributes, new_element):
return
# def transfer_xml_attributes ends here


def check_xml_empty(xml_element):
"""Check if an element has neither attributes, text or children"""

attributes = xml_element.attrib
text = xml_element.text
children = xml_element.getchildren()

if len(attributes) == 0 and text is None and len(children) == 0:
return True
else:
return False
# def check_xml_empty ends here


def split_with_milestone_element(element, milestone, splitter):
"""Split the text of an element by inserting milestone tags."""

Expand Down

0 comments on commit b9786df

Please sign in to comment.