[whatwg] Re: DOCTYPE shouldn't be optional

Malcolm Rowe malcolm-what at farside.org.uk
Wed Jul 7 07:12:05 PDT 2004


Ian Hickson writes:
>> Hmm, yes. I was wondering about this as well. As far as I know, all
>> post-HTML2 HTML documents and all XHTML documents require a DOCTYPE.
> That hinges on the definition of "XHTML document".
> [...]
> If you then create a document using "XML" and "Namespaces in XML" that
> only contains elements from [the XHTML] namespace, the semantics are
> well-defined, since the XHTML spec defines the semantics.

A very good point, and one that had entirely passed me by. 

> But is it an XHTML document?

If you mean "Is it a 'Strictly Conforming XHTML Document', as defined in 
section 3.1.1 of the XHTML 1.0 spec? [1]", then no, it's not. 

If you mean "Is it a document containing well-defined semantic elements from 
the XHTML namespace?", then yes, it is. 

;) 

> The point is that it isn't a change. It's a fact. It described the current
> reality of using namespaces in XML.
> The real question is, why does XHTML1 claim otherwise?

Well, they're actually defining a new term, that of a 'strictly conforming 
XHTML document', so I guess that they're entitled to define whatever they 
want. 

The only problem with that definition is that many people (myself included) 
have interpreted this clause to mean that any document using only the XHTML 
namespace must be a 'strictly conforming XHTML document', which, of course, 
doesn't actually make sense, given XHTML's intent to be an XML application. 

[I would note that, in general, there is no way to determine what the 
meaning of a document composed from multiple namespaces is. That very issue 
is actually the topic of the W3C TAG's issue mixedNamespaceMeaning-13, now 
subsumed by mixedUIXMLNamespace-33 [2], focussing on XHTML, MathML, SVG, 
etc.] 

It *is* true to say, contrary to what I said before, that you don't need to 
have a DOCTYPE to be 'an XHTML document' (which isn't a well-defined term, I 
agree). However, it's also true to say that you do need a DOCTYPE to be a 
'strictly conforming XHTML document'. 

Perhaps you could add a note in the prose about 'strictly conforming XHTML 
documents'? 

[moved]
> The only difference between a document that complies to XHTML 1.0, and the
> document you create by using XML, "Namespaces in XML", and the XHTML
> namespace, is the presence or absence of the DOCTYPE.

Not strictly true, actually - there are also some restrictions on DTD 
subsets, for example. See the previously quoted reference for more detail 
(or alternatively the XHTML 1.1 spec, which, as far as I can tell, says 
essentially the same thing in a far more obscure fashion). 

But essentially, you're absolutely right. 

>> I'm also confused about "other XML languages over HTTP" - this
>> specification extends HTML and XHTML, so what other (non-XHTML) XML
>> languages can this spec apply to?
> Any. That's the beauty of XML namespaces. You could write an SVG document
> that included some XHTML elements inside a <foreignObject> block, for
> example.

Ok. You're actually primarily talking about serving a document that makes 
use of elements from the XHTML namespace, though, not particularly whether 
it uses elements from a different namespace, so this is a little confusing - 
you seem to be placing restrictions on the use of MIME types for any other 
XML language, whereas you're actually just quoting already-established 
requirements. Also, "XML languages over HTTP" got me thinking that you were 
talking about SOAP, or something like that. 

Perhaps you could change the prose to read something like the following: 

HTML documents that use the new features described in this specification and 
that are served over HTTP must be sent as text/html and must use the 
following DOCTYPE: <!DOCTYPE html PUBLIC "-//WHATWG//NONSGML HTML5//EN">. 

XML documents using elements from the XHTML namespace that use the new 
features described in this specification and that are served over HTTP must 
be sent using an XML MIME type such as application/xml or 
application/xhtml+xml and must not be served as text/html. [RFC3023] 

These XML documents may contain a DOCTYPE if desired, but this is not 
required unless the document is intended to be a 'strictly conforming XHTML  
document' as defined by the XHTML specification [XHTML1]. 

Thoughts? 

Regards,
Malcolm 

[1] http://www.w3.org/TR/xhtml1/#strict
[2] http://www.w3.org/2001/tag/issues.html#mixedUIXMLNamespace-33 




More information about the whatwg mailing list