Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Function already offered by lxml: addnext, addprevious
  • Loading branch information
Klaus Thoden committed Nov 22, 2018
1 parent 9e5bcbd commit 076f1ac
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions libeoaconvert.py
Expand Up @@ -364,21 +364,3 @@ def get_place_in_xml_tree(element, tree):

return position
# def get_place_in_xml_tree ends here

def insert_after(new_element, preceding, before=False):
"""Insert an element after another
Optional keyword argument inserts element before
"""

parent_element = preceding.getparent()
context_children = parent_element.getchildren()
preceding_position = context_children.index(preceding)
if before:
insertion_point = preceding_position
else:
insertion_point = preceding_position + 1
parent_element.insert(insertion_point, new_element)

return
# def insert_after ends here

0 comments on commit 076f1ac

Please sign in to comment.