lora-sp | 09a58a0 | 2023-03-10 16:33:46 +0100 | [diff] [blame^] | 1 | import sys |
| 2 | import xml.etree.ElementTree as ET |
| 3 | from lxml import etree |
| 4 | from io import StringIO |
| 5 | |
| 6 | ''' |
| 7 | for i in range(1, len(sys.argv)): |
| 8 | print("file: " + str(i) + " " + sys.argv[i]) |
| 9 | try: |
| 10 | ("normaler parse geklappt") |
| 11 | parser = etree.XMLParser(recover=False) |
| 12 | tree = ET.parse(sys.argv[i], parser) |
| 13 | #tree = ET.parse(sys.argv[i]) |
| 14 | root = tree.getroot() |
| 15 | print(root.tag) |
| 16 | except: |
| 17 | print("nö") |
| 18 | #with open |
| 19 | ''' |
| 20 | |
| 21 | parser = etree.XMLParser(recover=True) |
| 22 | tree = ET.parse("dnevnik.bg - 2020-01-02.xml", parser) |
| 23 | ET.register_namespace("", "http://www.tei-c.org/ns/1.0") |
| 24 | tree.write("outputTEST.xml", encoding='utf-8', xml_declaration=True, method='xml', short_empty_elements=True) |
| 25 | |
| 26 | |