I need to force xmlschema
library to validate only against locally provided schemas (and not any schema provided in XML)
XML can provide different versions of schema as absolute url but I want map those urls to local directory so I doesn't need network access.
For example if schema in XML is https://example.com/v1.0.0/schema.xsd
,
I want to look in /path/to/some/dir/v1.0.0/schema.xsd
How this can be done in xmlschema
?
I tried to load XML using xml.etree.ElementTree
and find the schema URL and create a XMLShema
object to validate against, Is there a better way to do this?