From 8ecac476bf077df0c8cfb500d04b56033d9020a4 Mon Sep 17 00:00:00 2001 From: Klaus Thoden Date: Thu, 30 Aug 2018 14:45:43 +0200 Subject: [PATCH] New function --- fix_tei.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fix_tei.py b/fix_tei.py index 3b34a19..044e46c 100644 --- a/fix_tei.py +++ b/fix_tei.py @@ -54,6 +54,19 @@ TMP_DIR = os.path.expanduser("tmp_files") +def get_place_in_xml_tree(element, tree): + """Find out the position of an element in a tree. + + Return the index. Example: how to insert an element after a specific + element + """ + + xml_children = tree.getchildren() + position = xml_children.index(element) + + return position +# def get_place_in_xml_tree ends here + def parse_bibtex(bibfile): """Parse the bibtex file, return a dict"""