Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -39,12 +39,19 @@ def get_table_download_link(file_path):
|
|
39 |
href = f'<a href="data:file/htm;base64,{b64}" target="_blank" download="{os.path.basename(file_path)}">{os.path.basename(file_path)}</a>'
|
40 |
return href
|
41 |
|
42 |
-
def
|
43 |
words = xml_text.split()
|
44 |
english_words = [word for word in words if re.fullmatch(r'[A-Za-z ]*', word)]
|
45 |
compressed_text = ' '.join(english_words)
|
46 |
return compressed_text
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
def read_file_content(file):
|
49 |
if file.type == "application/json":
|
50 |
content = json.load(file)
|
|
|
39 |
href = f'<a href="data:file/htm;base64,{b64}" target="_blank" download="{os.path.basename(file_path)}">{os.path.basename(file_path)}</a>'
|
40 |
return href
|
41 |
|
42 |
+
def CompressXML_Old(xml_text):
|
43 |
words = xml_text.split()
|
44 |
english_words = [word for word in words if re.fullmatch(r'[A-Za-z ]*', word)]
|
45 |
compressed_text = ' '.join(english_words)
|
46 |
return compressed_text
|
47 |
|
48 |
+
def CompressXML(xml_text):
|
49 |
+
tree = ET.ElementTree(ET.fromstring(xml_text))
|
50 |
+
for elem in tree.iter():
|
51 |
+
if isinstance(elem.tag, ET.Comment):
|
52 |
+
elem.getparent().remove(elem)
|
53 |
+
return ET.tostring(tree.getroot(), encoding='unicode')
|
54 |
+
|
55 |
def read_file_content(file):
|
56 |
if file.type == "application/json":
|
57 |
content = json.load(file)
|