RE: Minimized P valid XHTML?

Osmo Saarikumpu:

> Is the following document then perfectly valid, as the validator 
> says,

If the validator says it's valid, it most probably is.

> or is it invalid, as it would seem to me (according to my understanding 
> of the the wording of the Reformulation of HTML 4 in XML 1.0):

If you take e.g. "<p />" to both a start tag, and an end tag at the
same time, you might reach a different understanding that is more
along the lines of what the validator says.

> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>     "http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
> <title>Testing</title>
> </head>
> <body>

> <h1 />Hello world!

That is an empty "h1" followed by text that is not part of the "h1".

> <q />Hello again!

That is an empty "q" followed by text that is not part of the "q".

> <p />Have a nice day!

That is an empty "p" followed by text that is not part of the "p".

> </body>
> </html>

Your code is indeed valid. But it would not have been if you had
used the Strict version of XHTML 1.0. In Strict you can't have
naked text inside of "body". You must wrap the text in some block
element.

Even so, you should not serve code like this to ordinary browsers.
Most of them will not get it right.

#####################################################################
                          Bertilo Wennergren
                  <http://purl.oclc.org/net/bertilo>
                         <bertilow@chello.se>
#####################################################################
 

Received on Thursday, 29 March 2001 13:51:58 UTC