lora-sp | 435e467 | 2023-03-13 13:53:07 +0100 | [diff] [blame^] | 1 | import re |
| 2 | import sys |
| 3 | import xml.etree.ElementTree as ET |
| 4 | |
| 5 | def escape(file): |
| 6 | with open(sys.argv[i], "r+") as f: |
| 7 | print("opened") |
| 8 | file = f.read() |
| 9 | file = re.sub('&(?!gt;|apos;|quot;|lt;|amp;)', '&', file) |
| 10 | f.seek(0) |
| 11 | f.write(file) |
| 12 | f.truncate() |
| 13 | |
| 14 | for i in range(1, len(sys.argv)): |
| 15 | try: |
| 16 | ET.parse(sys.argv[i]) |
| 17 | except: |
| 18 | escape(sys.argv[i]) |
| 19 | #ET.parse(sys.argv[i]) |
| 20 | #print("sucess") |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | #for i in range(1, len(sys.argv)): |
| 26 | # try: |
| 27 | # ET.parse(sys.argv[i]) |
| 28 | # print("parsed") |
| 29 | # except: |
| 30 | # print("not parsed") |
| 31 | # replace(sys.argv[i]) |
| 32 | |
| 33 | |