W3C home > Mailing lists > Public > www-html@w3.org > April 2004

Re: HTML 4.01 DTD

From: Satoshi ISHIKAWA <webmaster@satoshii.org>
Date: Fri, 16 Apr 2004 18:33:10 +0900
To: <www-html@w3.org>
Message-ID: <BCA5D766.2697%webmaster@satoshii.org>

Robert van Loenhout <r.vanloenhout@greenvalley.nl> wrote:
> <!ELEMENT TABLE - -
> (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>
> <!ELEMENT CAPTION  - - (%inline;)*     -- table caption -->
> <!ELEMENT THEAD    - O (TR)+           -- table header -->
> <!ELEMENT TFOOT    - O (TR)+           -- table footer -->
> <!ELEMENT TBODY    O O (TR)+           -- table body -->
> <!ELEMENT COLGROUP - O (COL)*          -- table column group -->
> <!ELEMENT COL      - O EMPTY           -- table column -->
> <!ELEMENT TR       - O (TH|TD)+        -- table row -->
> <!ELEMENT (TH|TD)  - O (%flow;)*       -- table header cell, table data
> cell-->
> 
> This definition seems to me that a TR tag is not allowed to be a direct
> child of
> a TABLE tag. This surprised me... Also because when I validate a 4.01
> document
> with the w3c validator it says it is valid.
> 
> Could someone explain this?

As you quoted, the TABLE element MUST contain one or more TBODY elements,
and both of start tag and end tag of TBODY are omissible.

That is, in HTML 4.01

  <TABLE>
    <TR>...</TR>
    <TR>...</TR>
  </TABLE>

is equal to 

  <TABLE>
    <TBODY>
      <TR>...</TR>
      <TR>...</TR>
    </TBODY>
  </TABLE>.

So it is valid, to be sure.

# In addition, in the case of XHTML table, the table element is allowed
# to contain the tr elements directly.

Regards,
-- 
Satoshi ISHIKAWA / webmaster@satoshii.org
http://www.satoshii.org/markup/
Received on Friday, 16 April 2004 05:33:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:00 GMT