libXML now returnes info why XML is not valid (#218)
Co-authored-by: Adam Bem <adam.bem@zoho.eu> Reviewed-on: #218 Reviewed-by: Mikolaj Widla <widlam@noreply.example.com>
This commit is contained in:
		| @@ -77,10 +77,12 @@ def xsd(source: str, xsd: str) -> bool: | ||||
|     document_input = BytesIO(source.encode("utf-8")) | ||||
|     xml = etree.parse(document_input).getroot() | ||||
|      | ||||
|     if xml_schema.validate(xml): | ||||
|         return "XML is valid." | ||||
|     else: | ||||
|         return "XML is NOT valid." | ||||
|     try: | ||||
|         xml_schema.assertValid(xml) | ||||
|         return "XML is valid" | ||||
|     except etree.DocumentInvalid as e: | ||||
|         return str(e) | ||||
|  | ||||
|      | ||||
|      | ||||
| def xslt(source: str, xslt: str) -> str: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user