General Entities

General entities

In DTDs, an entity allows you to define a symbol for a value. In the Tree view, you can define general entities and parameter entities. The value of a general entity can be just about anything. It can be

  • A short string that represents a longer string
  • A way to include another marked-up file
  • A reference to a graphical image
  • A placeholder for some non-XML data or an expression that needs special formatting

General entities have names of the form &name;, where the name follows the usual rules for XML names (above).

To declare a general entity, use a declaration of this general form in your DTD:

<!ENTITY ename "text">

where ename is the name of the entity you are defining (without the initial & and final ;), and text is the text you want substituted for that entity.

For example, to define an entity named &cr; with your copyright string, you might use a declaration like this:

    <!ENTITY cr "Copyright (C) 1763 Cotton Mather LLP">
Go to- Certified XML Developer Tutorial
DTD Entities
Parameter Entities

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?