Working with entities

General entities are placeholders for any information contained within the root element of an XML document. They can be of the following three types.

Character entities

These entities are used in place of special characters.

Example:
> or > for >

Check here for more examples.

Content entities

These entities are used to mark a common block of content that presents often in the document. Content entities can be internal (that are defined inside the XML file) or external (that reside in separate file(s)).

Example:
Internal content entity:
<!ENTITY school "UW-Superior">
Once been defined, this entity can be referenced as &school;.
Example:
External content entity:
<!ENTITY description SYSTEM "description.xml">
This format uses the key term SYSTEM and assumes a file description.xml If this file has the following content
<school_description>Wisconsin's Public Liberal Arts College </school_description>
it is plugged into the XML document by using the standard entity syntax &description;.

Unparsed entities

Some data like images of video files should not be parsed at all. The unparsed entity tells the system to parse the data as is.

Example:
<!ENTITY uws_image SYSTEM "uws.jpg" NDATA JPEG>
Here the keyword NDATA stays for notation data and JPEG specifies the file type, in this case a graphics file.