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
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
from lxml import etree
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)
Bu iş için 19 freelancer ortalamada $114 teklif veriyor
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 Daha Fazla
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 Daha Fazla
Hi, I am a python developer and I have experience parsing data Please contact me to discuss your project
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.
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 Daha Fazla
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 Daha Fazla
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. :)
Hello. I have good skills in Excel and Python. Contact me please. Thanks................................................................................................................................
hello, how are you ? I read your requirement carefully, then very interested in your project. I work newly on this site, but have rich experience in programming using python. I can use several packages such as Daha Fazla
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())
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 Daha Fazla
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 Daha Fazla