This commit is contained in:
2023-02-10 14:51:06 +01:00
parent d35103422b
commit 84aef5d830

View File

@@ -37,14 +37,16 @@ def xsd(source: str, xsd: str) -> bool:
:type source: str :type source: str
:param xsd: XSD schema to validate XML against :param xsd: XSD schema to validate XML against
:type xsd: str :type xsd: str
:return: If the validation was successful or not :return: Message saying, if the validation was successful or not
:rtype: bool :rtype: str
""" """
xml_schema = etree.XMLSchema(etree.XML(xsd)) xml_schema = etree.XMLSchema(etree.XML(xsd))
xml = etree.XML(source) xml = etree.XML(source)
if xml_schema.validate(xml):
return xml_schema.validate(xml) return "XML is valid."
else:
return "XML is NOT valid."
def xslt(source: str, xslt: str) -> str: def xslt(source: str, xslt: str) -> str: