473,395 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XHTML standard rationale question

Why does the standard require that certain elements have certain child
elements? For example, the <head> element must have a <title> element
as a child, and <table> must have at least one <tr> child element.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #1
23 1758
Christopher Benson-Manica wrote:
Why does the standard require that certain elements have certain child
elements? For example, the <head> element must have a <title> element
as a child, and <table> must have at least one <tr> child element.


Because it is logical that:
1. Every document must have a title?
2. Every Table must have a Table Row?

--
Gus
Jul 23 '05 #2
Christopher Benson-Manica <at***@nospam.cyberspace.org> wrote:
Why does the standard require that certain elements have certain child
elements? For example, the <head> element must have a <title> element
as a child, and <table> must have at least one <tr> child element.


The two examples you give are also rerquirements in HTML, not just in
XHTML.

To turn your questions around-
Why should a document exist without a title?
Why should a table exist without any rows?

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 23 '05 #3
Christopher Benson-Manica wrote:
Why does the standard require that certain elements have certain child
elements?
Both HTML and XHTML require children for certain elements. I'm of the
opinion that some elements don't make sense without content.

For example, a paragraph isn't much of a paragraph without text
content. Whilst the HTML Specification allows an empty P element, it
does discourage them and suggests that user agents ignore them. I
expect that content isn't a requirement because of empty paragraph
hacks used in legacy documents.
For example, the <head> element must have a <title> element as a child,
As the HTML Specification implies in the quote below
(<URL:http://www.w3.org/TR/html4/struct/global.html#h-7.4.2>), the
TITLE element has an important purpose from an accessibility
perspective. The TITLE element is also extremely important for search
engines.

"For reasons of accessibility, user agents must always make the
content of the TITLE element available to users"

As any reasonable document has a title, an HTML document should have a
TITLE element. Moreover, for a user agent to conform with the quoted
statement, a document must have a title to make available.
and <table> must have at least one <tr> child element.


A table is a very good example of what I said previously: it isn't
very meaningful without any content, is it?

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
Steve Pugh <st***@pugh.net> spoke thus:
Why should a document exist without a title?
Why should a table exist without any rows?


Say, for example, that the title of the document is generated by
script. Given the standard, one must include an empty title element
to enable validation of the page. Similarly, a CGI must check that
there are elements to put in a table before it writes the open and
close tags.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #5
Michael Winter <m.******@blueyonder.co.invalid> spoke thus:
Both HTML and XHTML require children for certain elements. I'm of the
opinion that some elements don't make sense without content.
They may not make sense, but if UA's ignore them I don't see the harm
in permitting them in conforming documents.
As any reasonable document has a title, an HTML document should have a
TITLE element. Moreover, for a user agent to conform with the quoted
statement, a document must have a title to make available.


The title element is, I suppose, a special case...

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #6
On Sun, 13 Feb 2005 23:41:17 +0000 (UTC), Christopher Benson-Manica
<at***@nospam.cyberspace.org> wrote:
Steve Pugh <st***@pugh.net> spoke thus:
Why should a document exist without a title?
Why should a table exist without any rows?


Say, for example, that the title of the document is generated by
script. Given the standard, one must include an empty title element
to enable validation of the page. Similarly, a CGI must check that
there are elements to put in a table before it writes the open and
close tags.


This is reasonable.

A recent change to the RSS specification(s) was to clarify that an
enpty list of <item>s was a valid RSS document. This is quite
reasonable, because (as you say) there can be automatically-generated
cases when there simply are no such items in scope.

For the case of <title> though, all HTML documents have a title. There
is _always_ a sensible interpretation for the title of the document,
even if this is merely re-stating the URL.

In the case of <tr> within a <table>, then the null <table> is
meaningless. The table may well be empty, but this should suppress the
entire <table>, not just its content (this does not exclude a table
empty of data that still has a header).

Jul 23 '05 #7
Christopher Benson-Manica wrote:
Steve Pugh <st***@pugh.net> spoke thus:

Why should a document exist without a title?
Why should a table exist without any rows?


Say, for example, that the title of the document is generated by
script.


Say for example, a user agent that doesn't support script or has it
disabled? You really need to think about accessibility and graceful
degredation in such cases. BTW, AFAIK, Google doesn't support script,
so google won't see your title and that may lower your ranking. There
will also be nothing for google to show as the title in search results.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web
Jul 23 '05 #8
Christopher Benson-Manica <at***@nospam.cyberspace.org> wrote:
Steve Pugh <st***@pugh.net> spoke thus:
Why should a document exist without a title?
Why should a table exist without any rows?
Say, for example, that the title of the document is generated by
script. Given the standard, one must include an empty title element
to enable validation of the page.


A script on the server or client side?

If on the server then there's no problem. You should be validating
your output - the same code that gets sent to the browser.

If client side then your pages have no titles as far as users (or
search engines) without scripting are concerned and hence the
validator is quite correct in saying that they are broken.
Similarly, a CGI must check that
there are elements to put in a table before it writes the open and
close tags.


Yes. That's the right way to do it.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 23 '05 #9
Christopher Benson-Manica <at***@nospam.cyberspace.org> wrote:
Steve Pugh <st***@pugh.net> spoke thus:
Why should a document exist without a title?
Why should a table exist without any rows?
Say, for example, that the title of the document is generated by
script. Given the standard, one must include an empty title element
to enable validation of the page.


No, one must include _a_ title element. Making its content empty is your
choice and cannot, unfortunately, be prevented by a DTD.

If validation tells you that a document without a title element is invalid,
then it's a _good_ thing. That's the kind of things that DTDs and
validators are for.

If a script generates an HTML document without a title, then it's a broken
script. Fix it, don't complain about a tool that revealed the error.
Similarly, a CGI must check that
there are elements to put in a table before it writes the open and
close tags.


And this too is indeed a _good_ thing. It may imply that a script may need
to use buffering, e.g. generate the lines into an internal string, then
check whether it's empty before generating table markup. Or you might use a
Boolean variable that tells whether the start of table markup has been
generated. Or something else, perhaps more tree-oriented.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #10
Christopher Benson-Manica wrote:
Michael Winter <m.******@blueyonder.co.invalid> spoke thus:
Both HTML and XHTML require children for certain elements. I'm of
the opinion that some elements don't make sense without content.


They may not make sense, but if UA's ignore them I don't see the
harm in permitting them in conforming documents.


If UAs ignore them, why include them in the first place? You're just
adding unnecessary bulk to a document that a UA will have to spend
time stripping out.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #11
Michael Winter <m.******@blueyonder.co.invalid> wrote:
They may not make sense, but if UA's ignore them I don't see the harm
in permitting them in conforming documents.


If UAs ignore them, why include them in the first place?


Besides, it is not a requirement that UAs ignore, say, <table></table>.
It is syntactically erroneous, so browsers could do whatever they want.
If the syntax were changed to allow it, then a well-designed specification
would have to define its _meaning_ as well. What might that be? And
browsers would need to decide on the rendering.

For example, a browser might use some default top and bottom margin for a
table. Should it suppress that for an empty table, if it were allowed.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #12
Christopher Benson-Manica wrote:
Michael Winter <m.******@blueyonder.co.invalid> spoke thus:

Both HTML and XHTML require children for certain elements. I'm of the
opinion that some elements don't make sense without content.

They may not make sense, but if UA's ignore them I don't see the harm
in permitting them in conforming documents.


It's not a question of harm, it's a question of declaring what the
meaning of a TABLE is. A table is fundamentally a collection of rows, at
least one, so it's defined that way. Likewise with a list: a list
without items is meaningless, so a UL is defined to contain *one* or
more items, not zero or more.

Why *would* someone want to put a TABLE element with no rows on a page?
Jul 23 '05 #13
Steve Pugh <st***@pugh.net> spoke thus:
A script on the server or client side?
Client side; I knew I should have specified, sorry.
If client side then your pages have no titles as far as users (or
search engines) without scripting are concerned and hence the
validator is quite correct in saying that they are broken.
Our pages are never indexed by search engines anyway, and indeed until
I got ahold of them they were CGI scripts that weren't indexed anyway.
Yes. That's the right way to do it.


Only because that's the way the standard is written...

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #14
Jukka K. Korpela <jk******@cs.tut.fi> spoke thus:
For example, a browser might use some default top and bottom margin for a
table. Should it suppress that for an empty table, if it were allowed.


I would say that a pretty simple standard would be that any empty
element would be rendered as though it had a value of "none" for the
display property.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #15
Jukka K. Korpela <jk******@cs.tut.fi> spoke thus:
And this too is indeed a _good_ thing. It may imply that a script may need
to use buffering, e.g. generate the lines into an internal string, then
check whether it's empty before generating table markup. Or you might use a
Boolean variable that tells whether the start of table markup has been
generated. Or something else, perhaps more tree-oriented.


There are certainly ways around the issue, but if empty elements were
allowed none of them would be necessary.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #16
Christopher Benson-Manica <at***@nospam.cyberspace.org> wrote:
For example, a browser might use some default top and bottom margin
for a table. Should it suppress that for an empty table, if it were
allowed.


I would say that a pretty simple standard would be that any empty
element would be rendered as though it had a value of "none" for the
display property.


But to see whether an element is empty, a browser would need to investigate
its content as a separate ad hoc test. It makes more sense to do such
things when the document is _generated_, especially since it is difficult
to assign any sensible _meaning_ to an empty table or empty list, for
example

Moreover, it would raise the question what is empty. <p></p> is surely
empty, but what about <p> </p>? Or <p>&nbsp;</p>?

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #17
Jukka K. Korpela <jk******@cs.tut.fi> spoke thus:
But to see whether an element is empty, a browser would need to investigate
its content as a separate ad hoc test. It makes more sense to do such
things when the document is _generated_, especially since it is difficult
to assign any sensible _meaning_ to an empty table or empty list, for
example


That's what I was looking for, it makes sense to me now. Thanks.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #18
Christopher Benson-Manica wrote:
Our pages are never indexed by search engines anyway...


How can you possibly justify that statement? If anyone had ever linked
to your site and it was available to the public on the WWW, it is highly
likely that google and other search engines will have indexed your site.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web
Jul 23 '05 #19
Lachlan Hunt <sp***********@gmail.com> spoke thus:
How can you possibly justify that statement? If anyone had ever linked
to your site and it was available to the public on the WWW, it is highly
likely that google and other search engines will have indexed your site.


But it *isn't* available to the public on the WWW. Users must be
logged in to get to these pages, and the Google robot does not have an
account with us :)

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #20
Christopher Benson-Manica <at***@nospam.cyberspace.org> wrote:
Lachlan Hunt <sp***********@gmail.com> spoke thus:
How can you possibly justify that statement? If anyone had ever linked
to your site and it was available to the public on the WWW, it is highly
likely that google and other search engines will have indexed your site.


But it *isn't* available to the public on the WWW.


So why did you post to this newsgroup? Did you miss the WWW in the
group name?

If you are creating private documents for private use then use a
private DTD and validate against that. Then you can redefine the
semantics of your private HTML-like-language to be whatever suits your
purposes.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 23 '05 #21
Steve Pugh <st***@pugh.net> spoke thus:
So why did you post to this newsgroup? Did you miss the WWW in the
group name?


Well, I'm glad I did in any case, and I appreciate the responses I've
gotten.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 23 '05 #22
Christopher Benson-Manica wrote:
Steve Pugh <st***@pugh.net> spoke thus:


[quote reinserted to make sense of what follows]
Similarly, a CGI must check that there are elements to put in a
table before it writes the open and close tags.


Yes. That's the right way to do it.

Only because that's the way the standard is written...


Well, yeah, that's the point of the standard, right? To require certain
things, or make their inclusion the "right way to do it".

--
Brian
Jul 23 '05 #23
begin quote from Christopher Benson-Manica in message
<cu**********@chessie.cirr.com> on Sun 2005 February 13 17:41:
Steve Pugh <st***@pugh.net> spoke thus:
Why should a document exist without a title?
Why should a table exist without any rows?


Say, for example, that the title of the document is generated by
script.


Scripting is always optional. Many user agents (browsers) do not support
scripting at all, and those that do always let you disable it.

--
Shawn K. Quinn
Jul 23 '05 #24

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to...
32
by: Werner Partner | last post by:
I put this question already, but erhaps it "came under the wheels" because it was hidden in another thread. Nevertheless it's important for me to understand the problem and solve it. Old html...
119
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see,...
13
by: PJ | last post by:
How is it that Microsoft sits on the w3c, participates in XHTML standardization and then completely misses the ball with asp.net? Does Microsoft have any plans/announcements/concern whatsover...
12
by: Alex D. | last post by:
How can I stop asp.net from rendering XHTML istead of HTML? My javascripts are rendering wrong because of that. It is rendering &amp; to clients instead of &. Any help? Thanks, Alejandro.
5
by: Viken Karaguesian | last post by:
Hello everyone, I have a question about the XHTML doctype. I often times see this statement included in the <html> tag: <html xmlns="http://www.w3.org/1999/xhtml"> If I use the full...
4
by: musosdev | last post by:
I think I'm having a dim day and should just go back to bed, but alas, I cant do that.... I'm writing a peice of code to create XHTML compliant documents using System.IO, there's probably an...
19
by: Bert Lancaster | last post by:
I'm not actually using it on the web but can anyone tell me why the ID attribute on a <style> tag causes an error in the W3C validator for an XHTML 1.1 document? It doesn't have a problem for a...
6
by: Rolf Welskes | last post by:
Hello, if I have for example: <table style="width: 100%; height: 100%;" border="1"> <tr> <td style="width: 100px">k </td> <td style="width: 100px">k </td> </tr>
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.