Commmented redundat endpoints
This commit is contained in:
@@ -23,7 +23,7 @@ def formatHTML(source: str, prettify: bool) -> str:
|
||||
return html.tostring(htmlDoc).decode().replace("\n", "").replace("> ", ">")
|
||||
return etree.tostring(htmlDoc, encoding='unicode', pretty_print=True)
|
||||
|
||||
def formatXML(source: str, prettify: bool) -> str:
|
||||
def formatXML(source: str) -> str:
|
||||
"""Method used to format XML
|
||||
|
||||
:param source: XML to format
|
||||
@@ -46,10 +46,7 @@ def formatXML(source: str, prettify: bool) -> str:
|
||||
parser = etree.XMLParser(remove_blank_text=True)
|
||||
xml = etree.parse(byte_input, parser=parser)
|
||||
|
||||
if prettify:
|
||||
prolog += "\n"
|
||||
|
||||
return prolog + etree.tostring(xml, pretty_print=prettify).decode()
|
||||
return prolog + etree.tostring(xml, pretty_print=False).decode()
|
||||
|
||||
|
||||
def xpath(source: str, xpath: str) -> str:
|
||||
|
||||
@@ -36,8 +36,8 @@ def process_xml(request: request, type: str) -> str:
|
||||
response_json['result'] = Parser.xslt(data, processorData)
|
||||
elif (type == "xpath"):
|
||||
response_json['result'], response_json['type'] = Parser.xpath(data, processorData)
|
||||
elif (type == "prettify"):
|
||||
response_json['result'] = Parser.formatXML(data, True)
|
||||
# elif (type == "prettify"):
|
||||
# response_json['result'] = Parser.formatXML(data, True)
|
||||
elif (type == "minimize"):
|
||||
response_json['result'] = Parser.formatXML(data, False)
|
||||
elif (type == "prettifyHtml"):
|
||||
@@ -77,9 +77,10 @@ def xsd():
|
||||
def xslt():
|
||||
return process_xml(request, "xslt")
|
||||
|
||||
@app.route("/prettify", methods=["POST"])
|
||||
def prettify():
|
||||
return process_xml(request, "prettify")
|
||||
# Removed because lxml can't pretify <xs:complexType mixed="true">
|
||||
# @app.route("/prettify", methods=["POST"])
|
||||
# def prettify():
|
||||
# return process_xml(request, "prettify")
|
||||
|
||||
@app.route("/minimize", methods=["POST"])
|
||||
def minimize():
|
||||
|
||||
Reference in New Issue
Block a user