Using custom XHTML doctype (Was: Re: [VE][117] Add Subject Here)

On Fri, 8 Jun 2007, Carl Bussema III wrote:

> When attempting to validate a skeleton page to test our DTD that adds target 
> back into XHTML 1.1, I get a very cryptic error about missing marked section 
> end.

On pragmatic grounds, XHTML 1.1 is an exercise in futility, and adding 
target "back" to it funny. But validation is formal, not 
pragmatic, so let's look at the problem.

> Searching the 'net, the only clue I can find is that this has something 
> to do with the DTD.

That's right. And here we have the problem that the W3C Validator does not 
usually report errors in a DTD. In fact, it is not uncommon - when playing 
with custom DTDs - to get a message saying that the document is not valid, 
without any indication of what and where the errors are. The good old WDG 
validator is more suitable in 
this respect (and due to less restrictions on the DTD) when using a custom 

> However, I copied the DTD directly from a site that is using it,

Perhaps there was a copying error, since the problem may have been caused
by an accidental deletion of a line.

> Validating
> Error [117]: "missing marked section end"

It's actually a pretty descriptive error message, though reported at an 
odd location. In the DTD, the entity declaration starting at line 27,
<!ENTITY % xhtml-lat1.entity "INCLUDE">
contains a marked section that is not ended anywhere. To fix this, add the 
end after line 31,
The end consists of
(cf. to the next declatation, from line 34 to line 39).

After reading lines 27 through 31, the validator goes to a state where it 
expects a marked section end, and it reports this only at the end of the 
XHTML document, so the message appears as relating to the </html> tag. The 
WDG validator is more informative: although it behaves essentially the 
same way, it precedes the error message with the following note:, line 28, 
character 1: marked section started here

P.S. When testing the page on Firefox 2, I get just an error message about 
XML parse error, for "&nbsp;", even after I have fixed the problem in the 
DTD. Apparently Firefox does not read an external subset (such as the file 
containing definitions for Latin 1 entities like "&nbsp;"); and this is 
permitted by the specifications. If you use a "standard" DTD instead, 
Firefox presumably recognizes that you're using XHTML and not generic XML, 
so it loads its internal set of definitions for "standard" entities in 

Jukka "Yucca" Korpela,

Received on Saturday, 9 June 2007 05:06:59 UTC