python - xs:import schemaLocation redirect not followed/https not supported in lxml? -


we've moved https-everywhere policy on our production infrastructure, , it's causing problems xml schema validation, wonder if can me clarify.

we have schema documents available @ static paths on our server, , once available @ http://path.to/schema.xsd. no longer available there, instead being @ https://path.to/schema.xsd, calls original url result in 301 (moved permanently).

the schema documents have references each other, in particular there's parent schema includes line:

<xs:import namespace="http://example.com/schemas/iso_639-2b/1.0"     schemalocation="http://example.com/static/iso_639-2b.xsd"> 

(note schemalocation points http version of url still, weren't anticipating having change this, redirect in place)

in attempting validate incoming xml document against schema

schema_path = "/path/to/file/on/disk/schema.xsd" schema_file = open(schema_path) schema_doc = etree.parse(schema_file) schema = etree.xmlschema(schema_doc) 

the root schema.xsd loads (since comes local disk), on final line, when initialise xmlschema (using lxml underlying etree implementation) exception:

{xmlschemaparseerror}element decl. 'language', attribute 'type': qname value '{http://example.com/schemas/iso_639-2b/1.0}languagecodetype' not resolve a(n) type definition., line 41 

my working theory lxml (or xml schema specification, though haven't been able find documentation) either doesn't follow redirects or doesn't support https (or both!).

any info, , advice on appropriate fix appreciated.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -