DTD entities
An entity is a variable used to define a shortcut to reference plain text or special characters of.
Entity reference is a reference to an entity.
Internal or external entity may be declared.
An internal entity declaration
grammar
<!ENTITY entity-name "entity-value">
Examples
DTD 实例:
<!ENTITY writer "Donald Duck.">
<!ENTITY copyright "Copyright W3CSchool.cc">
XML 实例:
<author>&writer;©right;</author>
<!ENTITY writer "Donald Duck.">
<!ENTITY copyright "Copyright W3CSchool.cc">
XML 实例:
<author>&writer;©right;</author>
Note: An entity composed of three parts: an ampersand (&), an entity name, and a semicolon (;).
An external entity declaration
grammar
<!ENTITY entity-name SYSTEM "URI/URL">
Examples
DTD 实例:
<!ENTITY writer SYSTEM "http://www.w3cschool.cc/entities.dtd">
<!ENTITY copyright SYSTEM "http://www.w3cschool.cc/entities.dtd">
XML example:
<author>&writer;©right;</author>
<!ENTITY writer SYSTEM "http://www.w3cschool.cc/entities.dtd">
<!ENTITY copyright SYSTEM "http://www.w3cschool.cc/entities.dtd">
XML example:
<author>&writer;©right;</author>