python lxml - use etree to parse XSD (xml schema) via https

The below code works with http but not https.

Unsure if its because the parser is serving the schema as HTML instead of XML.

Been trying to Google for a quick answer but so far no joy.

from lxml import etree

import urllib2

schema_src_file = [login to view URL]('-- url ---')

schema_doc = [login to view URL](schema_src_file)

schema = [login to view URL](schema_doc)

***Please message me if you think you have an answer.

Further details and discoveries.

OS, software, and versions
ubuntu = 16.4 LTS
python = 2.7
lxml = 4.2.1

Python Code
from lxml import etree
import urllib2

schema_src_file = urllib2.urlopen('url to xsd')
schema_doc = etree.parse(schema_src_file)
schema = etree.XMLSchema(schema_doc)

The above code works with http.
As soon as the url is changed to https the code breaks.
The interesting thing is, if all the supporing xsd files are downloaded locally, to the directory that the script runs from, the code runs A OK.

The other interesting thing is, when using Oxygen, with either http or https the schema loads fine. This might be because oXygen uses xerces rather than libxml2? Or maybe because Oxygen sets the header(s) as XML instead of trying to convert it to HTML?

The main XSD Schema has multiple imports (see below). The called xsd files in turn loads further xsd files.

Imports from main XSD:
<xs:import namespace="http://www.w3.org/1998/Math/MathML" schemaLocation="mathml2/mathml2.xsd">
<xs:documentation xml:lang="en"> Request elements make use of MathML for Special Authority form criteria. Schema location is relative to this resource. </xs:documentation>

<xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="xhtml1-strict.xsd">
<xs:documentation xml:lang="en"> Schedule Notes are encoded in xhtml. Schema location is relative to this resource. </xs:documentation>

<xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink.xsd">
<xs:documentation xml:lang="en"> xlink:href attributes are used to reference parts of the schedule </xs:documentation>

*** Please message if you think you have an answer

A similar issue seems to happen with simplexml_load_file when using https

$foXML = @simplexml_load_file(url to main xsd)

Kemahiran: Python, XML

Lihat lagi: parsing xsd in python, lxml xml schema, lxml validate against xsd, lxml parse url, generate xml schema python, lxml xml schema validation, python verify xml against xsd, python xml schema tutorial, sqlite python xml schema, python parse soap xml, python parse wikipedia xml dump, python library parse wikipedia xml, use sax parse big xml, use net parse xml file, python parse big xml, xml schema shell script, simple xml schema table, outlook contacts xml schema, create table xml schema, generic xml schema definition xsd gui translator

Tentang Majikan:
( 5 ulasan ) Wellington, New Zealand

ID Projek: #17173124

18 pekerja bebas membida secara purata $115 untuk pekerjaan ini

$155 NZD dalam 3 hari
(21 Ulasan)

I am a python developer having 6 + experience in IT industry. I am expert in: * Python, Web Development (Django, Flask) * Django REST Framework (DRF) * CSS, HTML5, Javascript, AJAX, JQuery, Bootstrap * R Lagi

$155 NZD dalam 3 hari
(86 Ulasan)

Hello, I am a python developer having 7 years of experience. I can assure that we are on the same page from the word go as I have worked on projects similar to yours in the past. And, therefore I can easily accomplish Lagi

$222 NZD dalam 3 hari
(5 Ulasan)

Hey there! Please have a look at my reviews and ping me so that we can discuss further on project. My skills & experience: -- 2.7 years of experience in building automation tools using python. -- Seasoned profe Lagi

$122 NZD dalam 2 hari
(30 Ulasan)
$155 NZD dalam 3 hari
(31 Ulasan)

hello. nice to meet you. I am a good scraping expert. I have a lot of experience in scraping(beautifulsoup4, scrapy, selenium). I want to discuss about your project with you. If you hire me, I will complete your p Lagi

$155 NZD dalam 3 hari
(8 Ulasan)

Hi, I am a python developer and I have experience parsing data Please contact me to discuss your project

$46 NZD dalam 3 hari
(16 Ulasan)

Ready to start the work to resolve the issue in your code with lxml in pyhthon we can discuss more over chat,thanks regards Arjun S.

$111 NZD dalam 3 hari
(8 Ulasan)
$111 NZD dalam 2 hari
(13 Ulasan)

Hello. I have good skills in Excel and Python. Contact me please. Thanks................................................................................................................................

$155 NZD dalam 3 hari
(10 Ulasan)

Hey There, I have very strong expertise in Python and is having more than five years of experience in enterprise level software development and automation using Python. I am very passionate about engineering and del Lagi

$100 NZD dalam 3 hari
(6 Ulasan)

Can you give me a chance? Python developer here from India and I would like to give this a try :) You can pay me up once you see that your issue is fixed. :)

$100 NZD dalam 3 hari
(8 Ulasan)
$100 NZD dalam sehari
(4 Ulasan)

use this scheme of work with xml from [login to view URL] import cElementTree as ET xml = [login to view URL]([login to view URL]('[login to view URL]').read())

$36 NZD dalam 3 hari
(1 Ulasan)
$155 NZD dalam 2 hari
(3 Ulasan)

Hello, I guess you are trying to scrape some website. From my experience, Selenium running Chromedriver combined with lxml is the best option. Code would be something like this: from selenium import webdriver fr Lagi

$88 NZD dalam 3 hari
(0 Ulasan)

Hello, With over 12 years of demonstrated experience, I am an individual developer but have an ability as a company, I can work with local developers near me as a team for completing your project as well. Please Lagi

$30 NZD dalam sehari
(1 Ulasan)
$66 NZD dalam sehari
(0 Ulasan)