mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/cqpserver.git
synced 2024-12-26 19:34:19 +00:00
17 lines
619 B
Python
17 lines
619 B
Python
import argparse
|
|
import xml.etree.ElementTree as ET
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('-i', dest='input_file', required=True)
|
|
parser.add_argument('--author', dest='author', required=True)
|
|
parser.add_argument('--publishing_year', dest='publishing_year', required=True)
|
|
parser.add_argument('--title', dest='title', required=True)
|
|
args = parser.parse_args()
|
|
|
|
element_tree = ET.parse(args.input_file)
|
|
text_node = element_tree.find('text')
|
|
text_node.set('author', args.author)
|
|
text_node.set('publishing_year', args.publishing_year)
|
|
text_node.set('title', args.title)
|
|
element_tree.write(args.input_file)
|