diff --git a/sosci2word/_README.txt b/sosci2word/_README.txt index 1a6c29b..2cf913c 100644 --- a/sosci2word/_README.txt +++ b/sosci2word/_README.txt @@ -77,7 +77,9 @@ NOTE: es ist mit den gegebenen Mitteln nicht möglich, das Tabellen-Styling zu s Verarbeitungs-Schema ~~~~~~~~~~~~~~~~~~~~ [yellow-background]#(dies ist der Plan zur Implementierung)#: -Fragebogen-Definitionen können mit der Mini-DOM-Library gelesen werden, das Word-Dokument mit python-docx. +Fragebogen-Definitionen können mit https://docs.python.org/3/library/xml.etree.elementtree.html[Elementtree] +aus der Python-Standard-Library gelesen werden, das Word-Dokument mit +https://python-docx.readthedocs.io/en/latest/index.html[python-docx(Documentation)]. Die Verarbeitung untergliedert sich in drei Phasen: 1. SoSci-Definitionen einlesen diff --git a/sosci2word/_SoSci2Word.mm b/sosci2word/_SoSci2Word.mm index acaedaa..a9c41b6 100644 --- a/sosci2word/_SoSci2Word.mm +++ b/sosci2word/_SoSci2Word.mm @@ -61,8 +61,8 @@ - - + + @@ -167,7 +167,7 @@ - + @@ -178,13 +178,20 @@ - - - - + + + + - - + + + + + + + + + @@ -236,7 +243,7 @@ - + @@ -249,7 +256,8 @@ - + + @@ -310,7 +318,12 @@ - + + + + + + @@ -320,15 +333,66 @@ Modul python-doxc

-
- - - + +
+ - + + + + + + + + + + + + + +

+ Beim Schreiben wird der bestehende Content verworfen und durch einen einzigen Run ersetzt, der den gegebenen Text ohne weitere Formatierungen enthält +

+ + +
+
+
+
+ + + + + + +

+ Modul elementtree +

+ + +
+ - - + + + + + + + + + + + + +
>>> from html import unescape
+>>> unescape('"')
+'"'
+ + +
+
+
diff --git a/sosci2word/experiment2.py b/sosci2word/experiment2.py new file mode 100755 index 0000000..a3c878e --- /dev/null +++ b/sosci2word/experiment2.py @@ -0,0 +1,23 @@ +#!/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')) \ No newline at end of file