HTML and CSS Reference
In-Depth Information
Table H-15 General Form of a Document Type Declaration with an Embedded Document
Type Definition
General form:
<!DOCTYPE Name
[
<!ELEMENT Parent Definition (Child Definition * | 1 | ?)>
<!ELEMENT Child Definition (child element list)
<!ELEMENT Child element Definition ANY|(#PCDATA)>
]
>
Comment:
!DOCTYPE is a reserved word that indicates the start of a document type declaration. Name
is any valid name of an element and defines the name of the embedded DTD. The square
bracket on line 2 indicates the beginning of the DTD. !ELEMENT is a reserved word that
defines the type of elements in the document. The child definition qualifiers are an asterisk (*),
a plus sign (+), or a question mark (?). The asterisk means zero to many, the plus sign means
one to many, and the question mark means zero or one only. Definition is one or more valid
element definitions. Whereas ANY indicates that any type of data may be associated with
the element, #PCDATA indicates that the element contains parsed character data, which is
text data. The square bracket in line 6 ends the DTD, and the right angle bracket on line 7
ends the document type declaration.
<?xml version="1.0" encoding="UTF-8"?>
<!-- File Name: video_collection.xml -->
<!DOCTYPE Video
[
<!ELEMENT Video (Movie*)>
<!ELEMENT Movie (Year, Title, Director, Type, Actor_Male, Actor_Female, Time, Rating)>
<!ELEMENT Year (#PCDATA)>
<!ELEMENT Title (#PCDATA)>
<!ELEMENT Director (#PCDATA)>
<!ELEMENT Type (#PCDATA)>
<!ELEMENT Actor_Male (#PCDATA)>
<!ELEMENT Actor_Female (#PCDATA)>
<!ELEMENT Time (#PCDATA)>
<!ELEMENT Rating (#PCDATA)>
]
>
<Video>
<Movie>
<Year>2000</Year>
<Title>Cast Away</Title>
<Director>Robert Zemeckis</Director>
<Type>Adventure</Type>
<Actor_Male>Tom Hanks</Actor_Male>
<Actor_Female>Helen Hunt</Actor_Female>
<Time>143</Time>
<Rating>PG-13</Rating>
</Movie>
</Video>
A Document Type Definition (DTD) is similar to a database schema and defines
the elements and attributes in an XML document. A DTD indicates how elements of an
XML document relate to each other. A DTD provides the grammar rules of a document.
When an XML document adheres to a DTD, it is considered valid.
A DTD can include element declarations, attribute list declarations, entity
declarations, and notation declarations. An element declaration defines the type of
content contained in an element. Table H-16 describes the basic form of an element
declaration.
Search WWH ::




Custom Search