DTD Entities

DTD – Entities


Entities

  • Entities as variables used to define shortcuts to common text.
  • Entity references are references to entities.
  • Entities can be declared internal.
  • Entities can be declared external

Internal Entity Declaration

Syntax:
<!ENTITY entity-name "entity-value">

DTD Example:
<!ENTITY writer "Jan Egil Refsnes.">
<!ENTITY copyright "Copyright XML101.">
XML example:
<author>&writer;&copyright;</author>

 


External Entity Declaration

Syntax:
<!ENTITY entity-name SYSTEM "URI/URL">

DTD Example:
<!ENTITY writer    SYSTEM "http://www.xml101.com/entities/entities.xml">
<!ENTITY copyright SYSTEM "http://www.xml101.com/entities/entities.dtd">
XML example:
<author>&writer;&copyright;</author>