HTML and CSS Reference
In-Depth Information
15.3.1. Comments
The syntax for comments within an XML DTD is exactly like that for
HTML comments: comments begin with <!-- and end with --> . The XML
processor ignores everything between these two elements. Comments
may not be nested.
15.3.2. Entities
An entity is a fancy term for a constant. Entities are crucial to creating
modular, easily understood DTDs. Although they may differ in many
ways, all entities associate a name with a string of characters. When you
use the entity name elsewhere within a DTD, or in an XML document,
language parsers replace the name with the corresponding characters.
Drawing an example from HTML, the &lt; entity is replaced by the <
character wherever it appears in an HTML document.
Entities come in two flavors: parsed and unparsed . An XML processor
will handle parsed entities and ignore unparsed ones. The vast majority
of entities are parsed. An unparsed entity is reserved for use within at-
tribute lists of certain tags; it is nothing more than a replacement string
used as a value for a tag attribute.
You can further divide the group of parsed entities into general entities
and parameter entities. General entities are used in the XML document,
and parameter entities are used in the XML DTD.
You may not realize that you've been using general entities within your
HTML documents all along. They're the ones that have an ampersand ( & )
character preceding their name. For example, the entity for the copy-
right (©) symbol ( &copy; ) is a general entity defined in the HTML DTD.
Appendix F lists all of the other general entities you know and love.
To make life easier, XML predefines the five most common general en-
tities, which you can use in any XML document. While it is still preferred
that they be explicitly defined in any DTD that uses them, these five en-
tities are always available to any XML author:
 
Search WWH ::




Custom Search