XML Document Structure
March 29, 2002
The XML Recommendation states that an XML document has both
logical and physical structure. Physically, it is comprised of
storage units called entities, each of which may refer to other
entities, similar to the way that include works in the C
language. Logically, an XML document consists of declarations,
elements, com-ments, character references, and processing
instructions, collectively known as the markup.
Note:
Although throughout this book we refer to an "XML document", it
is crucial to understand that XML may not exist as a physical
file on disk. XML is used to convey messages between
applications, such as from a Web server to a client. The XML
content may be generated on the fly, for example by a Java
application that accesses a database. It may be formed by
combining pieces of several files, possibly mixed with output
from a program. However, in all cases, the basic structure and
syntax of XML is invariant.
An XML document consists of three parts, in the order given:
-
an XML declaration (which is technically optional, but
recommended in most normal cases)
-
a document type declaration that refers to a DTD (which is
optional, but required if you want validation)
-
a body or document instance (which is required).
Collectively, the XML declaration and the document type
declaration are called the XML prolog.
Elements, Tags, Attributes and Content
XML Family of Specifications: A Practical Guide
XML Declaration
|