W3C home > Mailing lists > Public > www-html@w3.org > June 2000

RE: XHTML questions

From: Ian Graham <igraham@smaug.java.utoronto.ca>
Date: Tue, 27 Jun 2000 16:28:13 -0400
To: Piers Williams <PiersW@zinc.co.uk>
cc: www-html@w3.org
Message-ID: <Pine.SGI.4.05.10006271615050.119126-100000@smaug.java.utoronto.ca>

Recall that XHTML is an XML application -- the <?xml ... ?> is a part that
comes from the XML/SGML world. In an XML document, this declaration (it is
not a tag in the HTML sense) is actually optional (see the XML
specification at http://www.w3.org/TR/REC-xml for details -- the formal
rules are in sections 2.1, which define how a document is assembled, and
in section 2.8, which defines the document 'prolog' (see production rule
22) which, in turn, says that the XML declaration is optional.

Thus, if you're serving out XML as type text/html it is quite all right to
leave this part out.  

HOwever, if you want to declare the _character encoding_ used in the
document (which was the question being asked in the previous message), and
if you do so in a way understandable to XML software, then you must do so
within the xml declaration, so it can't be omitted.

Of course, if this is being processed as HTML, you would also want to
define the charset using a meta element of the form

<meta http-equiv="content-type" content="text/html; charset=...." >

as defined in Section 5.2.2. of the HTML 4.01 specification (see


On Tue, 27 Jun 2000, Piers Williams wrote:

> Why is this? I thought the whole point was that if you came across a tag you
> didn't understand, you just rendered the contents as if the tag wasn't
> there.
> This happens on both IE 3 and NN 3 and seems to be due to the '?' at the
> beginning, which begs the question why was _that_ character chosen when it
> would break backwards compatability.
> Oh well, I don't suppose there's many v3 browsers left...
> > -----Original Message-----
> > From: Ian Graham [mailto:igraham@smaug.java.utoronto.ca]
> > Sent: 27 June 2000 20:32
> > The XML declaration appears at the start of the document, and has
> > the form:
> > 
> > <?xml version="1.0" encoding="charsetvalue" ?>
> > 
> > However, older HTML browsers (e.g., Navigator 3) don't 
> > understand this,
> > and display this line
Received on Tuesday, 27 June 2000 16:28:17 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:54 UTC