Board index ‹ General discussions ‹ How to change MIME type to application/xhtml+xml ?
19 posts • Page 1 of 2 • 1, 2
How to change MIME type to application/xhtml+xml ?My blog at http://dieweltistgarnichtso.net/ identifies itself as text/html page. However, that limits me in embedding correct XHTML in posts, since browsers like Firefox parse the site as HTML.
How can i change the given MIME type to application/xhtml+xml ?
Re: How to change MIME type to application/xhtml+xml ?
Your template's index.tpl should contain a line like:
However, the Content-Type for html files (as far as I know) is always supposed to be "text/html" - what's your source for this being wrong? YL Did I help you?/Konnte ich helfen?
Custom s9y template? Contact me via Email or PM. Eigenes s9y-Template? Fragt per Email oder PM an.
Re: How to change MIME type to application/xhtml+xml ?
I was of the impression that S9Y outputs XHTML. The W3C validator thinks that, too.
Re: How to change MIME type to application/xhtml+xml ?
Yes, that's true. But that doesn't require changing the Content-Type (again, as far as I know). It's also true that you get some validation errors for your blog, but that's not very likely because of the different Content-Type but because of some XHTML errors in your posts. Let's see ... Okay, first of all, your index.tpl is missing an xmlns attribute. In that file, edit the <html> line like this:
Second, you have some tags in your source code which are not not valid XHTML - i.e. it's <br />, not <br/> (note the white space character). Are you using a WYGIWYS editor? Which one? YL Did I help you?/Konnte ich helfen?
Custom s9y template? Contact me via Email or PM. Eigenes s9y-Template? Fragt per Email oder PM an.
Re: How to change MIME type to application/xhtml+xml ?
It does; simply because browsers parse it as HTML otherwise. HTML has no namespace feature and isn't necessarily well-formed, so i can't embed XML, Javascript makes problems, too - in XHTML it must be masked as CDATA. In the end, I like XHTML better, it's simpler for most purposes and hasn't that many quirks.
I'm working on this. Since the XHTML engine wasn't triggered, I didn't notice it at first.
How come ? I though both was correct ...
Nope, I write code the old-fashioned way.
Re: How to change MIME type to application/xhtml+xml ?Hi!
You can emit XHTML with a simple html Content-Type, browser's accept this. Forcing an xhtml content-type header will make the site unparsable in case an error occurs. A simple "<br>" will lead to the WHOLE SITE not being displayed. This is the reason why Serendipity does not use XHTML as the content-type. You can emit that on your own if you edit/create a template'S config.inc.php and use:
However, I don't recommend that. No good comes from it. Regards, Garvin # Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/ # or use my PayPal account "paypal {at} supergarv (dot) de" # My "other" hobby: http://flickr.garv.in/
Re: How to change MIME type to application/xhtml+xml ?
I can't really tell you why this is, but it is
Very good, because in my humble opinion it's the only sane way to go if you want valid XHTML output YL Did I help you?/Konnte ich helfen?
Custom s9y template? Contact me via Email or PM. Eigenes s9y-Template? Fragt per Email oder PM an.
Re: How to change MIME type to application/xhtml+xml ?
W3C validator accepts it, apparently. I also couldn't locate anything in the XHTML spec.
They accept this as HTML, which means: No namespaces and possibly javascript errors.
I want that behaviour, so I can make my site standards compliant.
If you'd use it, errors in plugins would be noticed way sooner, wouldn't they ?
Aside of that I will be forced to write correct XHTML, any other problems ?
Re: How to change MIME type to application/xhtml+xml ?Hi!
Serendipitys Code is not the problem, it can be easily made XHTML compliant. User Input is the evil thing: Nobody prevents users from typing "<br>" in their boxes, no one prevents them from invalidly nesting Elements. There is no easy way to make sure that the user input on a page is always XHTML valid.
I can't really tell, my personal bottom line as always that the application/xhtml+xml was never required. You mentioned that namespaces cannot be used. What exactly do you mean? Which kind of errors do you get, when a document has text/html as content-type instead of application/xhtml+xml, when the content of the document is the same? Regards, Garvin # Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/ # or use my PayPal account "paypal {at} supergarv (dot) de" # My "other" hobby: http://flickr.garv.in/
Re: How to change MIME type to application/xhtml+xml ?
Well, check it against the XHTML DTD on submission ? I do a (simple) web app and we do exactly that - although our DTD is slimmed down to only include semantic elements.
XML has Namespaces, HTML hasn't. What is unclear about that ?
The embedding of Javascript is different between HTML and XHTML - as far as I am aware, user agents have hickups there. for XHTML it is
while for HTML you don't need the CDATA stuff. Konqueror, for example throws up on this and doesn't execute Javascript marked as CDATA.
Re: How to change MIME type to application/xhtml+xml ?Hi!
Simple user's don't understand semantics. All they want to do is blog and type. Putting them on validation restrictions is not productive. Sadly I don't have konqueror at my hands, so I cannot test the CDATA stuff. Other browsers do interpret CDATA with HTML mimetype as well, so I'm not sure who is misbehaving there. IMHO the content-type should always only be a type hint, not a type restriction -the content should matter..? Regards, Garvin # Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/ # or use my PayPal account "paypal {at} supergarv (dot) de" # My "other" hobby: http://flickr.garv.in/
Re: How to change MIME type to application/xhtml+xml ?
Look, those who can't even bother to learn some simple rules should probably not use tools like (X)HTML; it only makes life worse for the rest of us. XHTML rules are really simple, way simpler than HTML rules. And you say those who want to use it shouldn't abide by that rules ? Well, humanity did well along centuries without markup, then those lazy-asses can too, don't you think so ?
So ... what is the browser supposed to do on a page of unclear type ? A: Parse it as "tag soup" (read: HTML). Ditch XHTML features. B: Parse it as XHTML. Preserve XHTML features. Markup errors are fatal. I like the second much more, probably because I know what I am doing. And every (other) markup / programming language requires that to some extent. Please note the following: - In XHTML: <![CDATA[...]]> is a CDATA section. In HTML, it's a bogus comment. Actually, XHTML allows the use of CDATA sections, HTML does not. - XHTML allows non XHTML elements and attributes (in different namespaces) to be used, HTML does not. Actually, HTML permits no external namespaces. Best Regards, Summer Glau P.S.: Don't forget to read Ian Hickson's take on the subject matter.
Re: How to change MIME type to application/xhtml+xml ?Hi!
I believe the best way for you is to achieve this with a custom template (or plugin, if you prefer) that simply issues the PHP header() call. As for Serendipity, as long as browsers make a full page fail to render when markup errors occur, it is not good (read: beneficial for the common end-user) to use the xhtml+xml mimetype. If you prefer a patch to the s9y core to support the selection of the mimetype as a config option, we can gladly integrate this! Regards, Garvin # Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/ # or use my PayPal account "paypal {at} supergarv (dot) de" # My "other" hobby: http://flickr.garv.in/
Re: How to change MIME type to application/xhtml+xml ?
You should know what the spec says - and for all purposes of rendering a) XHTML with type text/html is actually HTML (see appendix C of the XHTML spec) and b) fail is there because you just can't guess, there are over 9000 possibilities in each case. Look at XHTMLMIME, which says:
With your stand on the matter, it will never be possible to actually call S9Y output XHTML, simply because XML features cannot be used that way.
Would be very nice. Am I expected to write this (i have no idea of S9Ys inner workings - would take a while) or will someone else do (because it probably is only a minor thing) ?
Re: How to change MIME type to application/xhtml+xml ?Hi!
Those pedantic enough that feel the need to do so, can do so with their own templates. Current templates focus on usability and compatibility instead of pedantic semantics
No one expects this of you! To me personally, the matter is not interesting yet because of the choking browser behavior on non-validating XHTML documents. I'm all for "ultra liberal HTML parsing". Regards, Garvin # Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/ # or use my PayPal account "paypal {at} supergarv (dot) de" # My "other" hobby: http://flickr.garv.in/
19 posts • Page 1 of 2 • 1, 2 Who is onlineUsers browsing this forum: Google [Bot] and 1 guest |