DTD online tuto...login
DTD online tutorial document
author:php.cn  update time:2022-04-20 15:01:34

DTD - Entity



Entities are variables used to define shortcuts that reference normal text or special characters.

  • An entity reference is a reference to an entity.

  • Entities can be declared internally or externally.


An internal entity declaration

Syntax

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

Example

DTD Example:

<!ENTITY writer "Donald Duck.">
<!ENTITY copyright "Copyright W3CSchool .cc">

XML example:

<author>&writer;©right;</author>

##Note: 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.w3cschool.cc/entities.dtd">
< !ENTITY copyright SYSTEM "http://www.w3cschool.cc/entities.dtd">

XML example:

<author>&writer;©right;</author>