<?xml?> Declaration Syntax
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml-stylesheet ...?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> ... </html>
Rules for coding the xml declaration for HTML 5
- Code the
<?xml?>
tag on the first line of the document, before anything else. When generating code using server-side scripting languages such as PHP, it should be the first thing that is output, after the HTTP headers. - The xml declaration starts with the characters
<?
, which indicates that the markup is a SGML declaration rather than an HTML tag. - Following the
<?
delimiters, code the lettersxml
in lower case. - Include a
version
attribute to indicate the characters that can be used in element names, and anencoding
attribute to specify the character encoding of the document. - Include a
standalone
attribute with the value"yes"
to indicate that the document is a standalone document and is not to be affected by any external declarations. - The xml declaration ends with the characters
?>
. - The
<?xml?>
tag does not have a matching end tag.
The following rules apply to the entire HTML document, based on the <?xml?> declaration:
- If the
version
attribute specifies XML version 1.1, any characters in the range  through Ÿ must be encoded as HTML character entities, in addition to all characters in the range  through . The NUL character &x#00; is not permitted in either version of XML.