xml Entities User-defined general (internal) entities


Example

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">
]>
<my-document>
    The entity was declared as follows: &my-entity;
    <element attribute="Entity: &my-entity;"/>
</my-document>