Physically, documents are composed of a set of "entities" that are identified by unique names (except the document entity that
we will discuss later). All documents begin with a "root" or document entity. All other entities are optional.
So as not to confuse you, I want to mention that you have not seen any entities in
previous examples, we have only needed to rely on the "document entity" that
you don't need to explicitly define because XML gives it to you for free. We'll look at entities in greater detail later.
What is important for the moment is that you understand that entities can be
thought of as aliases for more complex functions. That is, a single entity
name can take the place of a whole lot of text. As in any computer aliasing scheme, entity references cut down the amount of typing you have to do because anytime you need to reference that bunch of text, you simply use the alias name and the processor will expand out the contents of the alias for you.
As opposed to physical structure, XML documents have a logical structure as well.
Logically, documents are composed of declarations, elements, comments, character
references, and processing instructions, all of which are indicated in the
document by explicit markup.