blob: 2e9835427fb1359cf20bc1223a59ca3c66a6eeff [file] [log] [blame]
import xml.etree.ElementTree as etree
def entries_to_xml(entries, dict_id, dict_name, closed):
dictionary = etree.Element(u'Dictionary', IDName=dict_id)
<selection>etree.SubElement</selection>(dictionary, u'Name').text = dict_name
etree.SubElement(dictionary, u'Closed').text = repr(closed).lower()
etree.SubElement(dictionary, u'Action').text = u'false'
terms = etree.SubElement(dictionary, u'Terms')
for i, entry in enumerate(entries):
term = etree.SubElement(terms, u'Term')
etree.SubElement(term, u'Category')
words = etree.SubElement(term, u'Words')
return dictionary