blob: 2f1e9a8e9afeb699bb008091157834662c17651d [file] [log] [blame]
lora-sp435e4672023-03-13 13:53:07 +01001import re
2import sys
3import xml.etree.ElementTree as ET
4
5def 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;)', '&amp', file)
10 f.seek(0)
11 f.write(file)
12 f.truncate()
13
14for 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