The XML declaration appears as the first line in an XML document.
The XML declaration is not required, however, if used it must be the first line in the document and no other content or white space can precede it.
The version number is mandatory. Although number might change for future versions of XML, 1.0 is the current version.
The encoding declaration is optional.
If it is used, the encoding declaration must appear immediately after the version information in the XML declaration, and must contain a value representing an existing character encoding.
The encoding declaration identifies which encoding is used to represent the characters in the document. Although XML parsers can determine automatically if a document uses the UTF-8 or UTF-16 Unicode encoding, this declaration should be used in documents that support other encodings.
Example: ISO-8859-1 (Latin 1).
The standalone declaration is optional. If used, the standalone declaration must appear last in the XML declaration.
The standalone declaration indicates whether a document relies on information from an external source, such as external document type definition (DTD), for its content.
If the standalone declaration has a value of "yes", the parser will report an error if the document references an external DTD or external entities.
Leaving out the standalone declaration produces the same result as including a standalone declaration of "no". The XML parser will accept external resources, if there are any, without reporting an error.