fixing export, now working in lexonomy

This commit is contained in:
Ozbolt Menegatti 2019-11-13 23:16:28 +01:00
parent 58adffb104
commit b7b91fa6d6

View File

@ -41,7 +41,7 @@ def export_entry(entry):
body = doc.createElement("body") body = doc.createElement("body")
entry_xml.appendChild(body) entry_xml.appendChild(body)
sense_list = doc.createElement("sense_list") sense_list = doc.createElement("senseList")
body.appendChild(sense_list) body.appendChild(sense_list)
for sense in entry.senses: for sense in entry.senses:
@ -78,6 +78,24 @@ def export_sense(doc, sense):
translation_container.setAttribute("cluster", str(cidx + 1)) translation_container.setAttribute("cluster", str(cidx + 1))
translation_container_list.appendChild(translation_container) translation_container_list.appendChild(translation_container)
example_container_list = doc.createElement("exampleContainerList")
sense_xml.appendChild(example_container_list)
for example in sense.examples:
example_container = doc.createElement("exampleContainer")
example_container_list.appendChild(example_container)
example_xml = doc.createElement("example")
example_xml.textContent = example.example
example_container.appendChild(example_xml)
translation_container = doc.createElement("translationContainer")
example_container.appendChild(translation_container)
translation = doc.createElement("translation")
translation.textContent = example.translation
translation_container.appendChild(translation)
return sense_xml return sense_xml
def export_translation(doc, translation): def export_translation(doc, translation):