Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

DTD entity


May 28, 2021 DTD


Table of contents


DTD - Entity

This section describes entity declarations in DTD, which are used when entity declarations are made in DTD THEENTITY keyword to declare.

An entity is a variable that defines a shortcut that references 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

Grammar

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

Instance

DTD 实例:
<!ENTITY writer "Donald Duck.">
<!ENTITY copyright "Copyright w3cschool.cn">

XML 实例:

<author>&writer;&copyright;</author>

Note: An entity consists of three parts: a and a sign, an entity name, and a sign (;).

Tip: Internal entities are defined within the XML document, and the contents of the entities are given in the declaration. Internal entities are analyzed entities that do not have separate physical storage objects.


An external entity declaration

Grammar

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

Instance

DTD 实例:

<!ENTITY writer SYSTEM "//www.w3cschool.cn/entities.dtd">
<!ENTITY copyright SYSTEM "//www.w3cschool.cn/entities.dtd">

XML example:

<author>&writer;©right;</author>
Tip: External entities are defined in separate (external) files and can be between analyzed or unanalysed entities.