-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails to render a dynamic xml badge for webpages with a lowercased <!doctype> #10827
Comments
As a first step, have you considered raising an issue upstream on https://github.com/xmldom/xmldom and suggest doctype should be case insensitive when mimeType=text/html ? xmldom's goal is to be a ponyfill for |
@chris48s Thanks for the context. I didn't know for sure if it was just a xml or also a html parser. |
@chris48s can you hep me understand, is this code always parsing "dynamic xml" with the mime type The reason is that the HTML spec only allows I assume it is very likely there are also XHTML pages out there with more advanced doctypes. If that's the case I will need to provide a solution that sticks to the "lax parsing habits" of the html mime type. |
We look at the Content-Type header of the requested document. If it includes shields/services/dynamic/dynamic-xml.service.js Lines 138 to 144 in 152b8e9
I would expect most of the time a proper XHTML document would be served with the content type header If part of the fix here is for us to be a bit more sophisticated about parsing the header and passing mime type information to Just as a bit of context: The primary purpose of this integration is to read data from XML documents, although we do try to play nice with HTML as far as possible. |
That's great news. I will anyways support other doctypes in html, just to be sure. BTW: xmldom exports |
If you're up for submitting a PR, that would be great. A couple of notes:
This is why we currently use
|
Are you experiencing an issue with...
shields.io
🐞 Description
When an html document starts with a lowercased
<!doctype>
tag the following error is thrown:Not well-formed XML starting with "<!"
🔗 Link to the badge
Failing badges on domains with lowercased doctypes
Badge url: https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Fwww.google.com%2F&query=%2F%2Fdiv%5B%40id%3D%22gws-output-pages-elements-homepage_additional_languages__als%22%5D%2Fdiv
Url: https://www.google.com
Badge:
https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Faddons.opera.com%2Fen%2Fextensions%2Fdetails%2Fyoutube-ambilight%2F&query=%2F%2Fdt%5Bcontains(text()%2C%27Downloads%27)%5D%2Ffollowing-sibling%3A%3Add%5B1%5D
Url: https://addons.opera.com/en/extensions/details/youtube-ambilight/
Working badge on a domain with uppercased doctype
Badge: https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Fwww.bbc.com%2F&query=%2F%2Fdiv%5B%40data-testid%3D%22social-follow-us-container%22%5D%2Fh2
Url: https://www.bbc.com/
💡 Possible Solution
Transform
<!doctype>
to<!DOCTYPE>
before parsing the document with xmldom?The text was updated successfully, but these errors were encountered: