Re: Multiple xml declaration

Henri Fallon <henri@w3.org> wrote:

>On Tue, Dec 03, 2002 at 03:51:17AM +0100, Terje Bless wrote:
>>Note that, AFAICT, what you have there is _not_ extraneous "XML
>>Declarations"! There can be only one such and the grammar restricts
>>where in the document it may appear. The later instances are merely
>>generic Processing Instructions with the target "xml".
>
>If I get you well, you are saying that those lines are not to be called
>"XML Declarations".

Yes. "XML Declarations" are special instances of the general concept of
"Processing Instructions" (as is "<?xml-stylesheet" etc.) with restrictions
on where the may appear (notably, a XML Declaration must be pretty much the
very first thing in the file).


>My question was more whether they are supposed to be there are not :

The XML Recommendation restricts Processing Instructions with a target
matching "xml" (case-insensitively). In plainer terms that means it
reserves all Processing Instructions that start with "xml" for it's own
use. Two of the uses it puts them to is the XML Declaration and the
"<?xml-stylesheet" PI.


>if not, should it be considered as a bug that the validator doesn't spot
>it ? if they're not invalid, should the validator issue a warning ?

They are not invalid in that they are legal Processing Instructions and the
restriction on them is described in the prose and not the DTD (and I use
that term loosely). It _is_ bug in the Validator that it doesn't give a
warning about them because the XML Declaration does say that they are
restricted.

This issue is somewhat similar to bogus attribute values in (X)HTML; the
Validator is a purely DTD-based Validator so it can't (ATM) check whether
the attribute values make sense, only whether they are valid "CDATA".


The trouble with checking for these PIs is that the set of "approved" PI
targets is ever expanding. We /might/ be able to check for "<?xml " in
places it is not allowed to appear, but enforcing the general restriction
on any PI matching "<?xml-<foo> " would be hard to maintain (probably).


I'll try to think up a good summary of this issue and file a bug on it so
we can look into addressing it in the future. Thanks for the headsup!


-- 
"You gonna take advice from somebody who slapped DEE BARNES?!" -- eminem

Received on Monday, 2 December 2002 22:18:46 UTC