W3C home > Mailing lists > Public > www-validator@w3.org > April 2005

Re: [VE][82] Error Message Feedback

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Sun, 10 Apr 2005 01:30:40 +1000
Message-ID: <4257F520.8090501@lachy.id.au>
To: Marco Nef <nef@gmx.ch>
CC: www-validator@w3.org

Marco Nef wrote:
> Checking one of my pages (e.g.
> http://validator.w3.org/check?uri=http%3A%2F%2Fwww.shima.ch%2Fnewzealand%2Fauckland_01.php)
> there is always an error message that is about one of the JavaScript
> scripts. Obviously there's an error in your application. Maybe you should
> just ignore any scripts.

No, there is no error with the validator in this case.  It is your 
document that is invalid, you simply do not understand the reasons.

The most common script error occurs with document.write() statements, 
and is explained by the WDG.
http://htmlhelp.com/tools/validator/problems.html.en#script

However, those particular errors apply only to HTML 4.01, not XHTML 
documents.  Although, there are many other things you need to be aware 
of if you are going to use XHTML, but I strongly recommend you switch 
back to HTML 4.01, at least until you have a better understanding of 
what you are getting yourself into.

Firstly, document.write() does not work for XHTML documents.
http://ln.hixie.ch/?start=1091626816&count=1

The only reason it may appear to work for you in existing browsers is 
because you are using the incorrect MIME type (text/html).
http://www.hixie.ch/advocacy/xhtml

If you serve your document correctly as application/xhtml+xml, you will 
find that the supporting browsers will choke on your validation errors 
and simply not display the page.

To demonstrate: You will need a browser that supports XHTML, such as 
Firefox, Mozilla or Opera.  (IE *does not* support XHTML, so don't waste 
your time with it)

1. Copy the markup that the browser recieves (Use view source in your
    browser, don't use the PHP code which is executed by the server.)

2. Paste this markup into a new text document and save the file with a
    .xhtml extension.

3. Open the file in your browser from your local file system
    (ie. you don't upload to a server) and see the result.

If you are unhappy with the results, you will understand why using XHTML 
is not as simple as you thought.  Even if you fix the validation errors 
so that browsers don't choke, your document.write() scripts will not 
work.  This should explain why you should switch back to HTML 4.01, at 
least until you have a better understanding of the issues.

The documents I have referenced plus the the descriptions provided by 
the validator should help you understand how to fix the errors.

-- 
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/     Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Received on Saturday, 9 April 2005 15:30:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:18 GMT