Resolved #22
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user