An XML declaration (e.g: ) specifies the XML version and encoding of an XML document. It is optional for XML 1.0 version and UTF-8 encoding.
An XML declaration specifies the XML version and encoding of an XML document. It resembles a processing instruction but is technically not one. Here is an example of an XML declaration with the default values for version
and encoding
:
<?xml version="1.0" encoding="UTF-8" ?>
Only one XML declaration is allowed in an XML document, and it if one does appear, it may only be at the very top of the document.