mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 00:20:55 +07:00
12 lines
624 B
Python
12 lines
624 B
Python
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 |