Skip to content

XML DTD Entities

How to declare and use internal and external entities in XML DTDs, including syntax examples for shortcuts to special characters and reusable content.

Entities are used to define shortcuts to special characters.

Entities can be declared internal or external.

Example of Internal Entity Declaration

Syntax

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

Example

DTDxml
<!ENTITY writer "Tom Nolan">  
<!ENTITY copyright "Copyright TutorialReference.">
XMLxml
<author>&writer;&copyright;</author>

Example of External Entity Declaration

Syntax

<!ENTITY entity-name SYSTEM "URI">
or
<!ENTITY entity-name SYSTEM "URL">

Example

DTDxml
<!ENTITY writer SYSTEM "https://tutorialreference.com/entities.dtd">  
<!ENTITY copyright SYSTEM "https://tutorialreference.com/entities.dtd">
XMLxml
<author>&writer;&copyright;</author>
Navigation