23 lines
592 B
Python
23 lines
592 B
Python
|
|
#!/usr/bin/python3
|
||
|
|
|
||
|
|
from xml.etree import ElementTree
|
||
|
|
|
||
|
|
root = ElementTree.parse('ThesisFragebogen.2023-04-19.xml').getroot()
|
||
|
|
|
||
|
|
layout = root.find('surveyLayout').find('template')
|
||
|
|
print(layout.text)
|
||
|
|
|
||
|
|
quest = root.find('questionnaire').find('attributes.specific')
|
||
|
|
|
||
|
|
quest = next(a for a in quest.findall('attr') if a.get('id') == 'content')
|
||
|
|
|
||
|
|
print(quest.text)
|
||
|
|
|
||
|
|
questRoot = ElementTree.fromstring(quest.text)
|
||
|
|
|
||
|
|
for page in questRoot.findall('page'):
|
||
|
|
info = page.find('info')
|
||
|
|
if info != None:
|
||
|
|
print(info.text)
|
||
|
|
for quest in page.findall('question'):
|
||
|
|
print(quest.get('id'))
|