I showed you how to parse
W2Testfile.xml
in your last Thread, both with using BS and lxml for the task.IRSW2.xsd
is used for Validation,you still miss a file for that to work efileTypes.xsd
(see that is referenced in IRSW2.xsd).# Line 11 <xsd:include schemaLocation="efileTypes.xsd"/>
from lxml import etree xml_file = etree.parse("W2Testfile.xml") xml_validator = etree.XMLSchema(file="IRSW2.xsd") is_valid = xml_validator.validate(xml_file) print(is_valid)
Error:....
lxml.etree.XMLSchemaParseError: Element '{http://www.w3.org/2001/XMLSchema}include': Failed to load the document 'efileTypes.xsd' for inclusion., line 11
How to validate an XML file with an XML schema in Python