Re: [VE][388] Error Message Feedback

Jan Christian Anker wrote:
> However, if clicking on an icon yields 36 warning messages for a 100% 
> correctly written line of coding,

This comment:
<!-- ----------------- Text etc goes here ----------------- -->

is technically valid in HTML 4.01 and other SGML based languages, though 
its use is not recommended.  If you were using an HTML 4.01 DOCTYPE, you 
would not see any errors, but note that adding just one more hyphen 
could easily make it invalid HTML.

However, it is most certainly invalid in XHTML.  The fact that you are 
seeing "warnings" about this means you must be using XHTML and the fact 
that you think it's ok, means you're using the wrong MIME type too.

This is a problem in XHTML because that comment is not well-formed and, 
if you were using the correct MIME type, browsers would use an XML 
parser and immediately stop parsing when they encountered it.  In fact, 
the validator should be issuing errors for this, not warnings, but this 
is one of its many limitations with XML, due to its origin as an SGML 
validator.

You can see this for yourself if you like.  The easiest way, if you are 
testing from your local file system, is to give the file a .xml or 
.xhtml extension, then load it up in a browser that supports XHTML.  If 
you need to test from a web server, then it involves sending the correct 
MIME type in the HTTP headers: either application/xhtml+xml or 
application/xml

(Note: that does not involve changing the value of a certain meta 
element that is commonly misused for such purposes.)

-- 
Lachlan Hunt
http://lachy.id.au/

Received on Saturday, 13 May 2006 14:52:38 UTC