From a storage perspective, an XML document is made of entities. One of the entities is the document entity, which is the main XML document itself.

Entities can be classified like so (tentatively sorted by descending order of usage):

  • document entity: this is the main XML file.
  • internal general entities: this is the most common one besides the document entity, and the one most XML users are aware of. Often, the word entity is casually used for them. They allow specifying some shortcuts for longer replacement texts in document content. They are declared in the DTD.
  • the external DTD subset: another file in which part of the DTD is outsourced.
  • parameter entities: shortcuts, for use in the DTD.
  • external parsed general entities: they are XML fragments stored in other files.
  • unparsed entities: these can be any files on which XML places no restrictions, including images, sounds, etc.

In many cases, an XML document consists solely of the document entity.