DTD - Entity
- Previous page DTD attribute
- Next page DTD validation
Entities are variables used to define shortcuts for referencing common text or special characters.
Entity reference is the reference to the entity.
Entities can be declared internally or externally.
An internal entity declaration
Syntax:
<!ENTITY entity_name "Entity value">
Example:
DTD example:
<!ENTITY writer "Bill Gates"> <!ENTITY copyright "Copyright codew3c.com">
XML example:
<author>&writer;©right;</author>
Comment: An entity consists of three parts: an ampersand (&), an entity name, and a semicolon (;).
An external entity declaration
Syntax:
<!ENTITY entity_name SYSTEM "URI/URL">
Example:
DTD example:
<!ENTITY writer SYSTEM "http://www.codew3c.com/dtd/entities.dtd"> <!ENTITY copyright SYSTEM "http://www.codew3c.com/dtd/entities.dtd">
XML example:
<author>&writer;©right;</author>
- Previous page DTD attribute
- Next page DTD validation