Пример #1
0
def xml_lmf_write(object, filename):
    """! @brief Write an XML LMF file.
    @param object The LMF instance to write as XML.
    @param filename The name of the XML LMF file to write with full path, for instance 'user/output.xml'.
    """
    # Create the root XML element
    root = Element(object.__class__.__name__)
    # Create all XML sub-elements
    build_sub_elements(object, root)
    # Write all created XML elements in the output file
    write_result(root, filename)
Пример #2
0
def xml_lmf_write(object, filename):
    """! @brief Write an XML LMF file.
    @param object The LMF instance to write as XML.
    @param filename The name of the XML LMF file to write with full path, for instance 'user/output.xml'.
    """
    # Create the root XML element
    root = Element(object.__class__.__name__)
    # Create all XML sub-elements
    build_sub_elements(object, root)
    # Write all created XML elements in the output file
    write_result(root, filename)
Пример #3
0
 def test_write_result(self):
     import sys, os
     utest_path = sys.path[0] + '/'
     xml_filename = utest_path + "output.xml"
     # Create XML element with sub-element
     element = Element("LexicalEntry")
     SubElement(element, "Lemma")
     # Write result
     write_result(element, xml_filename)
     del element
     # Remove XML file
     os.remove(xml_filename)
Пример #4
0
 def test_write_result(self):
     import sys, os
     utest_path = sys.path[0] + '/'
     xml_filename = utest_path + "output.xml"
     # Create XML element with sub-element
     element = Element("LexicalEntry")
     SubElement(element, "Lemma")
     # Write result
     write_result(element, xml_filename)
     del element
     # Remove XML file
     os.remove(xml_filename)