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")
Received on Wednesday, 23 January 2008 20:47:39 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:59:06 UTC