And using hexadecimal
entities . With the proper mime-type and hexadecimal character references you don't need a doctype. I would ask you if you would find it difficult to code that way. You can still use the five predefined XML entities of course:
>. This way your XHTML file is independent from any doctype. I already changed my templates, since some browsers (ok, I admit, Mozilla) do not always interpreted the DTD correctly. Besides that, it is more forward compatible. This is only for the entities already specified, if you are using your own entities you will need a DTD (as far as I know, this isn't even possible using XML Schema).
Now the five tests why the
xmlns attribute with the value of http://www.w3.org/1999/xhtml is more important than a DTD IMHO. All the tests are served as
The first tests works, obvious. The second displays the source code, why? Because we did not declare we where using XHTML. So we can state that the
xmlns takes care of that, can't we? The third crashes. The fourth crashes, since I didn't use a DTD for that test it is obvious that the entity is not known by the UA. The fifth works! Hexadecimal character references are the answer. Use them!
I don't get it. Is the objective simply to have Mozilla not barf when it receives you document? (It will bravely try to render whatever you throw at it, subject only to the limitations of the expat XML parser.) Or do you simply not believe there is any difference (or, at least any difference worth mentioning to the User-Agent) between XHTML1.0, XHTML1.1, ... (which share the same xhtml namespace declaration)?
What you are doing is creating the XML equivalent of Tag-soup. Yes, the browser will handle it. No, it's not a good idea.
And when are you going to get a preview button?
I don't get it either..
The fifth link should be # XMLNS and an hexidecimal entity. :-)
Sorry Anne, can't say I understand the point of this either. Pick a particular representation (XHTML1.1, XHTML1.0, PDF, SVG etcetera) of content and be very explicit about sending it as such. It's very different from changing your URL space by removing extensions. In that sense you're creating a pointer to a document with many possible representations. A browser should be sent one solid version; which version is up to content negotiation.
Something is messed up? The fifth gives a blank page for me (using Firebird). If I look at the code, I see:
Besides this, I am strugling with the same question as my fellow commenters.
The fifth has a wrong URL, use the one I posted a bit up.
All I'm saying is that the XMLNS is more important than the
DOCTYPE. You can see this when you see example 1, 2 and 5 (now fixed). With only the
DOCTYPE declared there is nothing to see. If the XMLNS is declared the browser associates this with the default styling for XHTML elements.
DOCTYPE seems to make no difference (except for entities) I think it works better if I use hexadecimal entities besides the 5 predefined XML entities.
This post was not about file-extension. I only hide the file extension so I could alter it later. That has nothing to do with the MIME-type that has to be used for that file.
Anne, what is your point of this exercise? To show how browsers handle XHTML? To promote bad coding practices? Just playing around?
The specifications of HTML4 and XHTML1 are very clear that a document type declaration is mandatory. You cannot leave it out, the namespace attribute alone is not enough! Please do not throw us back into the dark ages of tagsoup!
Well, Ben, there is a point Anne could have made, had he not gotten sidetracked on the "xmlns" versus "DOCTYPE" thang.
Namely, current browsers don't actually parse the DTD that you declare. They just match your
DOCTYPE declaration with a set of built-in "known" DTDs. This can make life difficult for those who are attempting to exploit the Modularization of XHTML through custom DTDs.
While it is mandatory to declare a
DOCTYPE and while future browsers may make use of the information, throwing a custom DTD at current browsers (Mozilla) is basically a pig-in-a-poke, as unpredicable, really, as Anne's experiment of not setting a
DOCTYPE at all.
I was trying to make that point. Thanks for adding the word 'browser' and make it more clear. I like validating (and DTD's or XML Schema's), but I don't like browsers to crash on my homemade DTD. That's why I am going to use hexadecimal entities and a custom
DOCTYPE, so it won't crash.
And I was actually trying to ask you if I'm right at this point or that I should not use hexadecimal entities in favor of the ones declared inside a DTD.
I thought Mozilla was OK with entities declared in the
The difficulty is, as I said, that you are dealing with the unpredictable behaviour of Mozilla handling (what we've come to call here) XML Tag Soup. That behaviour might change in the next beta release. Documents which worked before might break, and vice versa.
All in all, I'm very sympathetic to the effort to get custom DTDs to work reliably in Mozilla. But this is, currently, a very murky subject.