The XML declaration is a processing instruction that identifies the document as being XML. All XML documents should begin with an XML declaration.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
- If the XML declaration is included, it must be situated at the first position of the first line in the XML document.
- If the XML declaration is included, it must contain the version number attribute.
- If all of the attributes are declared in an XML declaration, they must be placed in the order shown above.
- If any elements, attributes, or entities are used in the XML document that are referenced or defined in an external DTD, standalone="no" must be included.
- The XML declaration must be in lower case (except for the encoding declarations).
- The XML declaration has no closing tag, that is </?xml>.
The following table shows a list of the possible attributes that may be used in the XML declaration.
||Possible Attribute Value:
||Specifies the version of the XML standard that the XML document conforms to. The version attribute must be included if the XML declaration is declared.
||UTF-8, UTF-16, ISO-10646-UCS-2, ISO-10646-UCS-4, ISO-8859-1 to ISO-8859-9, ISO-2022-JP, Shift_JIS, EUC-JP
||These are the encoding names of the most common character sets in use today. For a full list of encodings check the IANA's website.
||Use 'yes' if the XML document has an internal DTD. Use 'no' if the XML document is linked to an external DTD, or any external entity references.