HTML and CSS Reference
In-Depth Information
elements is called the
content model
. If you further explore the specification to see what that
%inline
entity maps out to, you will see that it contains numerous other elements, such as
EM
,
STRONG
, and so on, as well as regular typed text. The final line defines the attributes for
a
<P>
tag as indicated by the entity
%attrs
which then expands to a number of entities like
%core
,
%i18n
, and
%coreevents
which finally expand into a variety of attributes like
id
,
class
,
style
,
title
,
lang
,
dir
,
onclick
,
ondblclick
, and many more. The full syntax
of the
P
element can be found in the reference in Chapter 3; the aim here is for you to
understand the syntax of SGML in a basic sense to support your understanding of how Web
browsers treat markup.
As another example, look at the HTML 4.01 DTD's definition of the
HR
element:
<!--=================== Horizontal Rule ================================-->
<!ELEMENT HR - O EMPTY -- horizontal rule -->
<!ATTLIST HR
%attrs; -- %coreattrs, %i18n, %events --
>
From this syntax fragment, note that the
HR
element has a start tag but does not require a
close tag. More interestingly, the element does not enclose any content, as indicated by the
EMPTY
designation. It turns out to have the same set of attributes as the
P
element, as
defined by the
%attrs
entity.
As mentioned in the previous section on the history of HTML, in 1999 the W3C rewrote
HTML as an application of XML and called it XHTML. XML, in this situation, serves the
same purpose as SGML: a language in which to write the rules of a language. In fact, XML is
in some sense just a limited form of SGML. XML and SGML can be used to write arbitrary
markup languages, not just HTML and XHTML. These would be called
applications
or, maybe
more appropriately,
application languages
. Numerous markup languages have been defined
with SGML and XML, and you could even define your own if you like. The relationship
between the various markup technologies is shown here:
Languages
Defined by
SGML
XML
…
…
…
Example
Application
Languages
SOAP
DocBook
WML
TEI
HTML
RSS
XHTML
The DTD defined in XML for the XHTML language is actually quite similar to the DTD
for traditional HTML. For example, consider the XHTML DTD entries for the two elements
previously presented:
<!--=================== Paragraphs =====================================-->
<!ELEMENT p %Inline;>
<!ATTLIST p
%attrs;
>