could not build an URI from the schemaLocation - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: could not build an URI from the schemaLocation (/thread-24070.html) |
could not build an URI from the schemaLocation - tharpa - Jan-29-2020 I have inherited a Python script from my predecessor. However, it is failing with the error in the subject line. One thing that is making it difficult to debug (via logging statements) is its use of the lxml module, which was made using Cython. I have tried making some changes to resolve the original error, which was slightly different. I have left the original in some comments below for reference. _ SCHEMA_DOC = """ <xs:schema targetNamespace="http://www.isotc211.org/2005/gmi" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:srv="http://www.isotc211.org/2005/srv"> <xs:include schemaLocation="{install_root}/schema/gmi/gmi.xsd"/> <xs:import namespace="http://www.isotc211.org/2005/gml" schemaLocation="{install_root}/schema/gml/gml.xsd"/> <xs:import namespace="http://www.isotc211.org/2005/srv" schemaLocation="{install_root}/schema/srv/srv.xsd"/> </xs:schema> """ def __init__(self): """ Load the 19115-2 schema so that every XML file produced is validated. """ # Interpolate the path to the XSD files. path = pathlib.Path(__file__).parent / 'data' schema_doc = etree.fromstring(_SCHEMA_DOC) # XML(_SCHEMA_DOC) # .format(install_root=path.as_uri()) # f = io.StringIO(schema_doc) self.schema = etree.XMLSchema(schema_doc) # file=fThe error is Any suggestions?
|