Re: Require XML version?

In message <3380E5B2.123AC088@calum.csclub.uwaterloo.ca> Paul Prescod writes:
> Is it really useful to make the XML version declaration optional? Our

The version is only optional if the <?XML...?> is omitted.  Any document 
which announces it it XML has to have a version number XML-LANG [23][24][25]

> experience with the Web says that it will be hardly ever used if it is.
> XML processors will not be able to depend on it just as HTML processors
> cannot. What is the rationale for having it be optional? Even valid XML
> documents need not declare their XML versions.

The question is when they should declare that they are XML, and IMO this is
important.  Suppose I get a doc "cml.dat" - from somewhere, without a MIME 
type:

<CML>
<MOL TITLE="benzene"/>
</CML>

we have no indication of what the file type is.  So, for WF docs we write:

<?XML VERSION="1.0"?>  <!-- the VERSION is now mandatory -->
<CML>
<MOL TITLE="C6H6"/>
</CML>

Most of us would agree that this is more useful than the first.  The problem
comes if we wish to re-use it - quite repsonsibly - in another WF document.

<?XML VERSION="1.0"?>
<!DOCTYPE FOO [
<!ENTITY benzene "cml.dat">
]>
<FOO>
One of Faraday's many discoveries was:<BR/>
&benzene;
</FOO>

Will this document parse?  There is a second <?XML...?> in the entity.
At that stage in the document it looks just like a PI.  Admittedly it
is in the XML namespace and (2.6) the use of PIs starting with XML in 
any way other than in the RedBook is an error.  So maybe a draconian 
parser would quit at this stage - a pity.
<PROPOSAL>
Any <?XML ...?> PI encountered within an element may be ignored by the
parser.  This would help re-use of DTD fragments.  Later it might even
be put to constructive use.  It could also check on incompatible versions
of XML (e.g. a VERSION 1 parser would not like to find a VERSION 2 fragment
embedded - I hope the reverse would be allowed :-)
</PROPOSAL>

	P.

-- 
Peter Murray-Rust, domestic net connection
Virtual School of Molecular Sciences
http://www.vsms.nottingham.ac.uk/

Received on Tuesday, 20 May 1997 06:31:09 UTC