Prolog
The prolog includes information that applies to the whole document such as the XML version, the character encoding, and the document structure.
- The
xml version
must be the first line in the document and no other content or white space can precede it. - The encoding declaration must appear immediately after the version information in the XML declaration.
- The
DOCTYPE
declaration allows you to identify the root element of the document and the related document type definition (DTD) by referencing an external file, through direct declarations, or both. ADOCTYPE
declaration can contain:- The name of the root element. This is mandatory when using the
DOCTYPE
declaration. - A subset of DTD direct declarations listed between brackets (
[ ]
). Each declaration is anENTITY
definition with the prefix string of a namespace that refers to an external vocabulary content. This is to reuse the terms or elements of the external vocabulary in the current vocabulary (acts like a C/C++#include
statement).
- The name of the root element. This is mandatory when using the