Click here to get back home

?xml Prolog & Box Model Issues in IE6

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
?xml Prolog & Box Model Issues in IE6 CJM 01-11-2007
Get Chitika Premium
Posted by CJM on January 11, 2007, 6:43 am
Please log in for more thread options


I'm in the process of partially revamping a corporate website. My main brief
was to reorganise much of the content and to update a lot of the copy, but
in the process I'm also trying to correct some of the technical aspects. The
site looks OK, but under the hood it is an abomination; it was designed by a
marketing company seemed to thing they were also web designers because they
owned a copy of Dreamweaver.

Amongst other things, I've replaced most of the images that were there
instead of headers(!); and I'm tackling the menu system that consisted
entirely of images (of text) with javascript rollovers.

But I can't change it all at this stage, so I'm still constrained by much of
the original design. I've replaced the image rollovers with the expected
html+css alternative. However, I'm finding a small problem under IE6 (I'm
testing under IE6, IE7, FF2 & Opera9); when I expand the menu to reveal the
sub-menu items, the background for these items is not full shaded.

I've bodged up a page to demonstrate:
http://www.brightnorth.com/cjm/emx/apps2.html

I assumed it was some sort of Box Model issue, and after a bit of
investigation I found that it indeed was... apparently IE6 reverts to the
quirky box model behaviour of IE5 if you include the ?xml prolog in an XHTML
page.

So I remove the offending line (ie the first) from the page and tested. Et
Voila! It works fine: http://www.brightnorth.com/cjm/emx/apps2.html

I've read in one place that this line is optional anyway, and can be
ignored; but lots of guides behave as if it compulsary. But I was wondering
what conventional wisdom says. Surely missing the prolog out it the best
options? Or are there reasons to keep it in? I don't fancy the idea of
inserting hacks to compensate.

Any thoughts?

CJM



Posted by Jukka K. Korpela on January 11, 2007, 7:11 am
Please log in for more thread options


Scripsit CJM:

> apparently IE6 reverts to
> the quirky box model behaviour of IE5 if you include the ?xml prolog
> in an XHTML page.

Indeed. _Anything_ before the DOCTYPE declaration causes that. I don't think
there's any other explanation than lazyness: people who wrote the "DOCTYPE
sniffing" code in IE didn't bother looking past the first line to find a
DOCTYPE declaration.

> I've read in one place that this line is optional anyway, and can be
> ignored;

By XML specifications, it SHOULD be there, but it is not required, if one of
the following is true:
a) the document's encoding is UTF-8
b) the document's encoding is UTF-16 (and the document starts with BOM)
c) there is an HTTP header specifying the encoding.

For an "official" tutorial on specifying the encoding, see
http://www.w3.org/International/tutorials/tutorial-char-enc/

> Surely missing the prolog out it the best options?

It's a simple one, but it's really feasible only when UTF-8 is used. Option
b, using UTF-16, is not practical on the web, due to poor support in
browsers and search engines. Relying on c) is somewhat risky, since the
document might be saved locally (e.g., by a user) in a manner that loses
information about HTTP headers.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


Posted by Toby Inkster on January 11, 2007, 9:06 am
Please log in for more thread options


Jukka K. Korpela wrote:

> By XML specifications, it SHOULD be there, but it is not required, if one of
> the following is true:
> a) the document's encoding is UTF-8
> b) the document's encoding is UTF-16 (and the document starts with BOM)
> c) there is an HTTP header specifying the encoding.

Your wording here is ambiguous, Jukka. When I first read this, I thought,
"no, Jukka has it the opposite way around" until I figured out which way
you meant it to be read.

What I initially thought Jukka was saying (which is wrong) was:

        If your document is in UTF-8 or UTF-16 (with BOM), or you
        specify the encoding in the HTTP headers, then you are not
        required to include the prologue, but you SHOULD.

What Jukka meant (and is correct) is:

        If your document is in UTF-8 or UTF-16 (with BOM), or you
        specify the encoding in the HTTP headers, then you are not
        required to include the prologue. Otherwise, you SHOULD
        include it.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact


Posted by CJM on January 11, 2007, 10:43 am
Please log in for more thread options



> Jukka K. Korpela wrote:
>
>> By XML specifications, it SHOULD be there, but it is not required, if one
>> of
>> the following is true:
>> a) the document's encoding is UTF-8
>> b) the document's encoding is UTF-16 (and the document starts with BOM)
>> c) there is an HTTP header specifying the encoding.
>
> Your wording here is ambiguous, Jukka. When I first read this, I thought,
> "no, Jukka has it the opposite way around" until I figured out which way
> you meant it to be read.
>

It's OK. It made perfect sense, without even considering
English-as-a-foreign-language.

It's also what I expected, if not what I wanted.



Posted by Jukka K. Korpela on January 11, 2007, 10:54 am
Please log in for more thread options


Scripsit Toby Inkster:

> Jukka K. Korpela wrote:
>
>> By XML specifications, it SHOULD be there, but it is not required,
>> if one of the following is true:
>> a) the document's encoding is UTF-8
>> b) the document's encoding is UTF-16 (and the document starts with
>> BOM)
>> c) there is an HTTP header specifying the encoding.
>
> Your wording here is ambiguous, Jukka.

It's ambiguous as regards to what the "if" clause applies to, but the
obvious (and intended) interpretation is that it applies to "it is not
required" only.

> What Jukka meant (and is correct) is:
>
> If your document is in UTF-8 or UTF-16 (with BOM), or you
> specify the encoding in the HTTP headers, then you are not
> required to include the prologue. Otherwise, you SHOULD
> include it.

No, that's not what I meant and that's not a correct description.

"XML documents SHOULD begin with an XML declaration which specifies the
version of XML being used."
http://www.w3.org/TR/REC-xml/#sec-prolog-dtd

It is required (i.e. it MUST be used) whenever none of the above-mentioned
cases applies, as the XML specification explicitly says:

"In the absence of external character encoding information (such as MIME
headers), parsed entities which are stored in an encoding other than UTF-8
or UTF-16 MUST begin with a text declaration (see 4.3.1 The Text
Declaration) containing an encoding declaration"
http://www.w3.org/TR/REC-xml/#charencoding

The words SHOULD and MUST are used in the XML specification as in "RFC
language", i.e. as defined in RFC 2119,
http://www.ietf.org/rfc/rfc2119.txt
This means:

1. MUST This word, or the terms "REQUIRED" or "SHALL", mean that the
definition is an absolute requirement of the specification.

3. SHOULD This word, or the adjective "RECOMMENDED", mean that there
may exist valid reasons in particular circumstances to ignore a
particular item, but the full implications must be understood and
carefully weighed before choosing a different course.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


Similar ThreadsPosted
Box Model in Internet Explorer 7.0 May 16, 2005, 10:22 am
An error message... "Content is not allowed in prolog." September 12, 2004, 3:27 am
Various Issues ... January 17, 2005, 4:32 pm
DOCTYPE Strict uses "correct" box model - so why is 100% width now useless? March 28, 2006, 5:16 pm
How can I replace a with an aka IE6/strict box model (and hacks). March 30, 2007, 10:32 am
Issues with IE and too many checkboxes April 25, 2005, 8:04 am
CSS issues with IE - not centering div November 14, 2007, 12:04 pm
Nested table issues January 10, 2005, 6:16 am
HTML/Framer issues February 8, 2008, 6:39 pm
Question on frames within iframe and scrollbar issues April 3, 2008, 2:15 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap