> Just a thought: Might this be proxy- or https-related? Does it work if you > locally serve the xs:included schema with http? > > I *think* libxml2 respects http_proxy but I don’t know anything about https > support.
Just found that for an example adapted from https://bugs.launchpad.net/lxml/+bug/1234114/comments/3 (xs:include instead of xs:import): ############## # test_schema.py XSD = b"""<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="lxmltest" targetNamespace="http://www.w3.org/1999/xlink" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:include schemaLocation="http://www.loc.gov/standards/xlink/xlink.xsd" /> </xs:schema> """ from lxml import etree parser = etree.XMLParser( load_dtd=True, no_network=True, huge_tree=True, resolve_entities=True) tree = etree.fromstring(XSD, parser=parser) schema = etree.XMLSchema(tree) print(schema) ############## I can successfully run this if the xs:include location is http but not https (the xlink.xsd is available both with https and http URLs). If I change it to https I get Traceback (most recent call last): File "test_schema.py", line 16, in <module> schema = etree.XMLSchema(tree) File "src/lxml/xmlschema.pxi", line 88, in lxml.etree.XMLSchema.__init__ lxml.etree.XMLSchemaParseError: Element '{http://www.w3.org/2001/XMLSchema}include': Failed to load the document 'https://www.loc.gov/standards/xlink/xlink.xsd' for inclusion., line 9 As I'm behind a proxy: I also just found out that while curl happily accepts http_proxy=my.proxy.address.net:8080 lxml (libxml2) only works if this is set to http_proxy=http://my.proxy.address.net:8080 i.e. with an explicit <scheme>:// Cheers, H. Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart HRA 4356, HRA 104 440 Amtsgericht Mannheim HRA 40687 Amtsgericht Mainz Die LBBW verarbeitet gemaess Erfordernissen der DSGVO Ihre personenbezogenen Daten. Informationen finden Sie unter https://www.lbbw.de/datenschutz. _______________________________________________ lxml - The Python XML Toolkit mailing list -- lxml@python.org To unsubscribe send an email to lxml-le...@python.org https://mail.python.org/mailman3/lists/lxml.python.org/ Member address: arch...@mail-archive.com