Content Model & Nesting (XHTML 1.1)


 

This page contains the nitty-gritty information which underpins the Interactive Nesting Tester and the Valid Parent and Child information stated in the reference page for each element.

Introduction

Groups of XHTML 1.1 elements are formed into nesting groups and then compound nesting groups are also defined, which contain other groups (Ref: the content model in the *XHTML 1.1 Document Model Module). Once these groups have been established, the allowed content (Content Model) of any element is specified in terms of these groups and/or individual elements and/or #PCDATA.

The content models are expressed using a standard syntax, similar to regular expression syntax or Extended Backus-Naur Form, where briefly:

( )
Parentheses: Used to group operands into a single, larger operand
|
Vertical bar: Indicates a choice of one or other of the adjacent operands
*
Asterisk: Zero or more occurrences of the preceding operand
+
Plus sign: One or more occurrences of the preceding operand
?
Question mark: Zero or one occurrence of the preceding operand
,
Comma: Each of the adjacent operands must occur and in the order specified.

Element Content Models

Below are listed the Content Models for all XHTML 1.1 elements, but first some words on elements with no content.

Elements with No Content

Elements which are declared with a Content Model of EMPTY must have no content whatsoever, not even whitespace or comments. This may be achieved either using the recommended empty-element tag, e.g. <br />, or by using an end-tag immediately following the start-tag, e.g. <br></br> (ref: *XML 1.0 Start-Tags, End-Tags, and Empty-Element Tags). It is recommended always to use the empty-element tag syntax, which is also recognised by HTML user agents, for these elements.
Note: the whitespace prior to the slash in the empty-element tag may validly be omitted (giving, for example <br/>) but it should be retained if compatibility with HTML is desired.

Conversely, elements which are not declared with a Content Model of EMPTY should open with a start-tag and close with an end-tag (e.g. <p>Paragraph Text</p>). There are many elements with a non-EMPTY Content Model which may validly contain no content (e.g. the p element) and the XML specification allows the empty-element tag to be used (e.g. <p />) if such an element has no content. It is recommended, however, always to use a start-tag and end-tag (e.g. <p></p>) for non-EMPTY elements which contain no content, especially if compatibility with HTML is desired.

Content Models

For a simple life: If all you want to do is test whether or not one element can be a child of another, why don't you try using the Interactive Nesting Tester?

Note: Any element which is not declared as EMPTY may additionally contain whitespace and/or comments in its content.

a Content Model
( #PCDATA | InlNoAnchor.mix )*
abbr Content Model
( #PCDATA | Inline.mix )*
acronym Content Model
( #PCDATA | Inline.mix )*
address Content Model
( #PCDATA | Inline.mix )*
area Content Model
EMPTY
b Content Model
( #PCDATA | Inline.mix )*
base Content Model
EMPTY
bdo Content Model
( #PCDATA | Inline.mix )*
big Content Model
( #PCDATA | Inline.mix )*
blockquote Content Model
Block.mix+
body Content Model
Block.mix*
br Content Model
EMPTY
button Content Model
( #PCDATA | BlkNoForm.mix | InlStruct.class | InlPhras.class | InlPres.class | I18n.class | InlSpecial.class )*
caption Content Model
( #PCDATA | Inline.mix )*
cite Content Model
( #PCDATA | Inline.mix )*
code Content Model
( #PCDATA | Inline.mix )*
col Content Model
EMPTY
colgroup Content Model
col*
dd Content Model
( #PCDATA | Flow.mix )*
del Content Model
( #PCDATA | Flow.mix )*
dfn Content Model
( #PCDATA | Inline.mix )*
div Content Model
( #PCDATA | Flow.mix )*
dl Content Model
( dt | dd )+
dt Content Model
( #PCDATA | Inline.mix )*
em Content Model
( #PCDATA | Inline.mix )*
fieldset Content Model
( #PCDATA | legend | Flow.mix )*
form Content Model
( BlkNoForm.mix | fieldset )+
h1 - h6 Content Model
( #PCDATA | Inline.mix )*
head Content Model
HeadOpts.mix*, ( ( base, HeadOpts.mix*, title, HeadOpts.mix* ) | ( title, HeadOpts.mix*, ( base, HeadOpts.mix* )? ) )
hr Content Model
EMPTY
html Content Model
head, body
i Content Model
( #PCDATA | Inline.mix )*
img Content Model
EMPTY
input Content Model
EMPTY
ins Content Model
( #PCDATA | Flow.mix )*
kbd Content Model
( #PCDATA | Inline.mix )*
label Content Model
( #PCDATA | input | select | textarea | button | InlStruct.class | InlPhras.class | InlPres.class | I18n.class | Anchor.class | InlSpecial.class | Misc.class )*
legend Content Model
( #PCDATA | Inline.mix )*
li Content Model
( #PCDATA | Flow.mix )*
link Content Model
EMPTY
map Content Model
( Block.mix | area )+
meta Content Model
EMPTY
noscript Content Model
Block.mix+
object Content Model
( #PCDATA | Flow.mix | param )*
ol Content Model
li+
optgroup Content Model
option+
option Content Model
#PCDATA
p Content Model
( #PCDATA | Inline.mix )*
param Content Model
EMPTY
pre Content Model
( #PCDATA | InlStruct.class | InlPhras.class | I18n.class | Anchor.class | tt | i | b | script | map )*
q Content Model
( #PCDATA | Inline.mix )*
rb Content Model
( #PCDATA | InlNoRuby.class | Misc.class )*
rbc Content Model
rb+
rp Content Model
#PCDATA
rt Content Model
( #PCDATA | InlNoRuby.class | Misc.class )*
rtc Content Model
rt+
ruby Content Model
( rb, ( rt | ( rp, rt, rp ) ) ) | ( rbc, rtc, rtc? )
samp Content Model
( #PCDATA | Inline.mix )*
script Content Model
#PCDATA
select Content Model
( optgroup | option )+
small Content Model
( #PCDATA | Inline.mix )*
span Content Model
( #PCDATA | Inline.mix )*
strong Content Model
( #PCDATA | Inline.mix )*
style Content Model
#PCDATA
sub Content Model
( #PCDATA | Inline.mix )*
sup Content Model
( #PCDATA | Inline.mix )*
table Content Model
caption?, ( col* | colgroup* ), ( ( thead?, tfoot?, tbody+ ) | tr+ )
tbody Content Model
tr+
td Content Model
( #PCDATA | Flow.mix )*
textarea Content Model
#PCDATA
tfoot Content Model
tr+
th Content Model
( #PCDATA | Flow.mix )*
thead Content Model
tr+
title Content Model
#PCDATA
tr Content Model
( th | td )+
tt Content Model
( #PCDATA | Inline.mix )*
ul Content Model
li+
var Content Model
( #PCDATA | Inline.mix )*

Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 16 May 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > Nesting in XHTML 1.1 > Content Model & Nesting (XHTML 1.1)