W3C home > Mailing lists > Public > www-validator@w3.org > March 2009

Re: Need help with cryptic validator error message

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Sun, 8 Mar 2009 21:49:19 +0200
Message-ID: <661138BE6CA74B2EB1884388C57D1ED6@JukanPC>
To: "Michele Cleary" <clearlymichele@yahoo.com>, <www-validator@w3.org>
Michele Cleary wrote:

> http://lyle.smu.edu/~mcleary/a4/getUserTable2.php
[...]
>         Line 3, Column 5:
>         XML Parsing Error:  XML declaration allowed only at the start
> of the document.

The error message is relatively to clear to me, even though the rule it 
refers to might be counter-intuitive. The XML declaration, i.e. <?xml etc. 
must (if present) be the very first thing in the document. Not even an empty 
line, a comment, or even an innocent space is allowed before it; this is 
formally expressed in the production rule at
http://www.w3.org/TR/REC-xml/#sec-prolog-dtd
Note the absence of anything before "XMLDecl" in the production for 
"prolog". Otherwise the productions contain "S?" where whitespace (such as 
empty lines) are allowed.

> ***This is my getUserTable2.php:

That's external to validation. Validation only deals with the document that 
your server sends in respose to a request.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 
Received on Sunday, 8 March 2009 19:50:08 GMT

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