Fixed for XSD
This commit is contained in:
		@@ -78,9 +78,13 @@ def xsd(source: str, xsd: str) -> bool:
 | 
				
			|||||||
    :param xsd: XSD schema to validate XML against
 | 
					    :param xsd: XSD schema to validate XML against
 | 
				
			||||||
    :return: Message saying, if the validation was successful or not
 | 
					    :return: Message saying, if the validation was successful or not
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    xml_schema = etree.XMLSchema(etree.XML(xsd))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xml = etree.XML(source)
 | 
					    schema_input = BytesIO(xsd.encode("utf-8"))
 | 
				
			||||||
 | 
					    xml_schema = etree.XMLSchema(etree.parse(schema_input).getroot())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    document_input = BytesIO(source.encode("utf-8"))
 | 
				
			||||||
 | 
					    xml = etree.parse(document_input).getroot()
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    if xml_schema.validate(xml):
 | 
					    if xml_schema.validate(xml):
 | 
				
			||||||
        return "XML is valid."
 | 
					        return "XML is valid."
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user