XHTML syntax
Partial explanation for the syntax diagram below. A correct XHTML document should begin with an xml tag, followed by a DOCTYPE tag, ending with an html block. An html block should be opened by an html tag, followed by a head block, followed by either a body block or a frameset block, and end by closing the html tag. The head block might have after the title tag, before the head tag closes, nothing, a link tag or other stuff. A body block can contain this between the two ends of the body tag: nothing, or a block block, a random number of times. Between the two ends of the title tag, there can be something, typically just text.
-- <?xml ?> -- <!DOCTYPE !> -- [html] --
[html]: -- <html> -- [head] -+- [body] -----+- </html> --
+- [frameset] -+
[head]: -- <head> -- <title>bla</title> -+------------+- </head> --
+- <link /> -+
+- - - - - --+
[body]: -- <body> ---+-----------+-+- </body> --
^ +- [block] -+ |
+---------------+
[frameset]: -- <frameset> ---+- <frame /> --+-+- </frameset> --
^ +- [frameset] -+ |
+------------------+
[block]: --+- <h1>bla</h1> -+--
+- <h2>bla</h2> -+
+- - - - - - - --+
+- <h6>bla</h6> -+
+- [p] ----------+
+- [table] ------+
+- [list] -------+
+- <hr /> -------+
+- - - - - - - --+
[inline]: --+- <em>bla</em> ---------+--
+- <strong>bla</strong> -+
+- <img /> --------------+
+- <a>bla</a> -----------+
+- - - - - - - - - - - --+
[p]: -- <p> ---+- bla ------+-+- </p> --
^ +- [inline] -+ |
+----------------+
[list]: --+- <ul> -+--- <li>bla</li> -+-+- </ul> -+--
+- <ol> -+ ^ | +- </ol> -+
+----------------+
[table]: -- <table> --- <tr> --- <td>bla</td> -+- </tr> -+- </table> --
^ ^ | |
| +----------------+ |
+-----------------------------------+
Concept last updated: 22/08 2003.
Relations
|
Other sources
- Beginning XHTML; Frank Boumphrey, CG, DR, JR, SS, TW - 3 Getting started - Basic XHTML block/inline elements