Prolog

The prolog of an XML document, when present, precedes the document element.

The prolog may, but need not, contain the following:

  • An XML declaration

  • Miscellaneous content—processing instructions or comments

  • A Document Type Declaration, also called a DOCTYPE declaration

Let’s look at each of these in turn.

The XML Declaration

The XML declaration can be as simple as this:

<?xml version="1.0" ?> 

This declaration is an optional part of all XML documents. However, when an XML declaration is present in an XML document, it must occur in the first line of the XML document and must have no characters—not even a single space character—before it.

An XML declaration, if present, must have a version attribute. For XML documents that correspond to ...

Get Sams Teach Yourself XML in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.