Added comments to Parser.py

This commit is contained in:
2023-02-23 09:58:00 +01:00
parent 169ba0d2d1
commit 8083d7fa63

View File

@@ -2,10 +2,20 @@ from lxml import etree
def prettify(source: str) -> str:
"""Method used to pretty format given XML
:param source: XML
:return: prettified XML
"""
xml = etree.XML(source)
return etree.tostring(xml, pretty_print=True).decode()
def minimize(source: str) -> str:
"""Method used to minimize XML by deleting not needed whitespaces.
:param source: XML
:return: minimized XML
"""
result = source
to_remove = [" ", " ", "\t", "\n"]