Re: Validating XHTML5 with XML entities

On Tue, Aug 26, 2008 at 11:36 PM, Jeff Schiller <codedread@gmail.com> wrote:
>
> The spec states that XHTML5 documents do not require a DOCTYPE [1].
> [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#editors

From the same page (§2.1 Terminology):
"The term HTML documents is sometimes used in contrast with XML
documents to specifically mean documents that were parsed using an
HTML parser (as opposed to using an XML parser or created purely
through the DOM)."

> A DOCTYPE must consist of "<!DOCTYPE HTML>" (case-insensitive) [2]
> [2] http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#the-doctype

§8.1.1 "The DOCTYPE" is part of §8.1 "Writing HTML documents". The key
words here are "HTML documents" which I have quoted the definition
above: §8.1 (and section §8 more generally) is not about XHTML5 ("XML
documents").
Actually, Ian just opened bug 5994
http://www.w3.org/Bugs/Public/show_bug.cgi?id=5994

> But a DOCTYPE is also where you declare XML entities.  For instance,
> my blog software emits &nbsp; so I added an XML entity at the top of
> my pages:
>
> <!DOCTYPE html [
>  <!ENTITY nbsp "&#160;">
> ]>
>
> Doing this seems to prohibit me from being able to generate valid
> XHTML5 (at least the experimental portion of the W3C validator that
> was recently added - html5.validator.nu does not complain).  Or maybe
> XHTML5 is XML entites (among other things)?  Or maybe the DOCTYPE
> definition could be expanded to optionally allow XML entities?
>
> I'd appreciate some insight.

XHTML5 is XML, so XML parsing rules apply.

-- 
Thomas Broyer

Received on Tuesday, 26 August 2008 21:54:37 UTC