Explanation is easy. My document is well-formed XML and contain some empty tags. If the text/html type is given, HTML parse mode is used and the empty tags are recognized as a tag start, and closed magically at the end of the document. This is exactly, what happened to me.
Sorry I bothered you. One more question (and I do not expect you to tell: "wow, what a nice idea, let's change it!" :) Why mime type wins over the DTD declaration (and even over the <?xml?> pragma)? Isn't the <?xml?> prolog enough to tell, ok, this is a xml file?
Thanks
Pavel
Pavel Hlavnicka wrote:
Hi all,
I went trough files at mozilla.org trying to figure out, what is wrong with my application/configuration, but I just got confused.
I have a XHTML 1.0 strict formatted page. If I save this page with the 'xhtml' extension, I get a bit different rendering as with 'html' extension. The same thing occur, if I serve this page with apache as text/html or application/xhtml+xml (I suppose the extension is used to guess the mime type for files).
This is the beginning of my file:
<?xml version='1.0' encoding='windows-1250'?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> .... and so on
Looking into the Mozilla source (nsParser.cpp) I've made following observations:
1) In both cases aParseMode is set to eDTDMode_full_standards
2) if the mime type is text/html aDocType is set to eHTML_Strict, if mime type is application/xhtml+xml, aDOCType is set to eXML.
Is it possible this causes the different rendering? Is it intended behavior or a bug?
I hope this mail makes a sense for somebody :)
Thanks in advance
Pavel
-- Pavel Hlavnicka Ginger Alliance www.gingerall.com
