XML declaration is optional, and it refers to version and encoding of the XML document. This lesson describes the XML declaration with examples.
<?xml version="1.0" encoding="ISO-8859-15"?>
<?xml version="1.0" encoding="ISO-8859-15"?> <address> <name>Alex</name> <company>w3schools</company> <phone>(091) 123-4567</phone> </address>
- Declaration of XML is also called the XML prolog.
- prolog of XML is case sensitive and must be written in lower-case.
- XML prolog is optional, but if required then it must be in the first line of the document.
- To avoid errors, encoding should be used, or XML file must be saved as UTF-8.
- The default character encoding for XML documents is UTF-8.