xml Entities User-defined general (internal) entities


It is possible to define one's own general entities. The declaration occurs in the DTD subset, with a name and the associated replacement text.

It can then be used in the document using the entity reference syntax &...;, either in text, or in attribute values.

<?xml version="1.0"?>
<!DOCTYPE my-document [
  <!ENTITY my-entity "This is my entity">
    The entity was declared as follows: &my-entity;
    <element attribute="Entity: &my-entity;"/>