The Document Prolog
Home ] Up ] [ The Document Prolog ] XML Elements ] The Root Element ] XML Attributes ] Attribute vs. Element? ] Whitespace and Comments ] XML Character Entities ] CDATA Sections ] Processing Instructions ] Well-Formed Documents ]

 

 

While not required, it is strongly recommended that an XML document start with a prolog that includes an XML Declaration

The XML Declaration specifies the version of XML being used.  

The XML Declaration can (and should) also specify the character encoding being used. For more information on character encodings, see http://www.w3.org/International/O-charset . Possible character encodings include:

  • Unicode encodings:
    • utf-8
    • utf-16
    • utf-32
  • Latin 1:
    • iso-8859-1

In addition, the XML Specification can specify whether the XML document is standalone or not. The standalone document declaration signals whether or not there are certain declarations which appear external to the document entity or in parameter entities.

For example, here are some typical XML declarations:

<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 
The page was last updated February 19, 2008