What does the XML declaration do?
The XML declaration must be listed at the top of the XML document: It specifies the following items: • The document is an XML document. This can be used by MIME sniffers to detect that a file is of type text/xml when the MIME type has been lost or has not been specified. • The document follows the XML 1.0 specification. This will be important in the future when XML has other versions. • The document character encoding. The encoding attribute is optional and defaults to UTF-8. Note: The XML declaration must be the first line in an XML document, so the following XML file: generates the following parse error: Invalid xml declaration. Line 0000002: Pos 0000007: ——^ Note: The XML declaration is optional. If you need to specify a comment or processing instruction at the top, then don’t put the XML declaration in at all. However, the encoding will be UTF-8,