W3C home > Mailing lists > Public > www-validator@w3.org > January 2008

Re: XML declaration

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Wed, 23 Jan 2008 22:47:09 +0200
Message-ID: <037501c85e01$1f9277d0$0500000a@DOCENDO>
To: "Maria Grazia Lucci" <luccig@unisi.it>, <www-validator@w3.org>

Maria Grazia Lucci wrote:

> Help! What should I do?

Remove the empty lines before the XML declaration  <?xml ...?>

>    Line 6, Column 5: XML Parsing Error: XML declaration allowed only
> at the start of the document.

Yes, by XML rules, nothing (not even spaces or line breaks) are allowed 
before the XML declaration. From the XML specification:

      [1]    document    ::=    prolog element Misc*

      [22]    prolog    ::=    XMLDecl? Misc* (doctypedecl Misc*)?
      [23]    XMLDecl    ::=    '<?xml' VersionInfo EncodingDecl? 
SDDecl? S? '?>'


(Strangely enough, the WDG validator passes your document.)

> <? Xml version = "1.0" encoding = "iso-8859-2?">

As a quite separate issue, and not directly related to validation, why 
are you using iso-8859-2 in a document in Italian? Using iso-8859-1 
instead, you could enter accented letters like "" as such and would not 
need to use entity references like "&agrave;".

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/ 
Received on Wednesday, 23 January 2008 20:47:39 GMT

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