HTML and CSS Reference
In-Depth Information
Table H-19 DTD Data Type Attributes
Modifier
Description
#DEFAULT value
Specific value set at the default attribute value
#FIXED "value"
Attribute value is fixed and must always take the default value assigned
#IMPLIED
Attribute value is optional; if used in an element type, no default value is supplied
#REQUIRED
Attribute value must be specified with the element
Entity Declarations
As just discussed, a DTD can also include
entity declarations
, which assign a name
to a block of text or other characters that can be interpreted as markup language and
substituted in a document. The replacement text must begin with an ampersand (&) and
end with a semicolon (;). Entity declarations can be internal or external. Table H-20 shows
the general form of an internal entity declaration. Table H-21 shows the predefined symbols
that can be used in an entity declaration.
Table H-20 General Form of Internal Entity Declaration
General form:
<!ENTITY name "&replacement;">
<ELEMENT>text "&replacement;"</ELEMENT>
Comment:
The attribute
name
is a valid element name and
replacement
is the entity characters to be
substituted within the string. Circular references are not allowed.
Example:
<!ENTITY copyright "©">
<PUBLISHED>2014 Cengage Learning ©right;</PUBLISHED>
Table H-21 Predefined Entity Symbols
Entity
Symbol
Explanation
&
&
Cannot be used in processing instructions
<
<
Use with attributes beginning with quotation marks
>
>
Use after ]] in normal text and processing instructions
"
“
Use in attributes within double quotation marks
'
'
Use in attributes within single quotation marks
&#x
hex
;
[varied]
Where
hex
is replaced with a hexadecimal value for a character, such as
A9 for the copyright symbol (©)
XML allows the use of external entities to refer to the contents of another file.
An external entity exists at a specified location or URL. The content of the external
file is inserted at the point of reference and parsed as part of the referring document.
Table H-22 shows the general form of an external entity.
Table H-22 General Form of an External Entity
General form:
<!ENTITY name PUBLIC/SYSTEM "URI/URL">
<ELEMENT>text "&replacement;" </ELEMENT>
Comment:
The attribute
name
is a valid element name; the
URI
or
URL
is an identifier that points to a file
on that system or a public file available via URL.
ENTITY
must be declared first.
Example:
<!ENTITY stockquotes SYSTEM
"www.cnbc.com/id/26272770/site/14081545/">
<inances>
<dowjones>Dow Jones Industrial Averages</dowjones>
&stockquotes;
</inances>