Add Site or Add Page to Favorites
 

 xml Declaration 

Clarify the meaning of the acronyms on your web site.

Acronym Dictionary

Acronym Finder

Get information on your favorite TV Shows at TV Series .com

Social Networking Web Sites


Printer-friendly PDF* format:

xml Declaration

The xml Declaration

The xml declaration in HTML 5

The xml declaration is the first line of code and indicates that the content is a HTML document.

Converting to HTML 5

We are working on converting to HTML 5. Please visit XML Declaration for HTML on the HTML 5 standard version of this site.

<?xml?> Declaration Syntax

Syntax of the <?xml?> declaration

Attributes of the xml Declaration

Attributes of the xml declaration

version attribute
The version attribute is coded as version="1.0", which indicates the document follows the XML version 1.0 syntax. The document should be coded to be "well-formed", even if it is not an entirely "valid" HTML document.
encoding attribute
The encoding attribute indicates what character encoding has been used to encode the HTML document as a file or byte input stream. Most importantly, among other things, this determines how many bytes of raw data are consumed to compose each character of the decoded document.
HTML 5 Examples

Examples of the xml declaration in HTML 5

The xml declaration appears at the very beginning of an HTML document:

                                 <?xml version="1.0" encoding="UTF-8"?>
                                 
<?xml-stylesheet type="text/xsl" href="/site-template.xsl"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
...
</html>

It is recommended that the encoding be specified using the preferred (MIME) name as specified in the IANA's Official Names for Character Sets. Some examples:

                                 <?xml version="1.0" encoding="UTF-8"?>
                                 
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="US-ASCII"?>
<?xml version="1.0" encoding="EUC-JP"?>
<?xml version="1.0" encoding="UTF-16"?>
<?xml version="1.0" encoding="ISO-10646-UCS-2"?>
<?xml version="1.0" encoding="ISO-10646-UCS-4"?>
Changes in HTML 5

What's new in HTML 5

Differences between HTML 5 and earlier versions

The xml declaration does not appear in HTML documents conforming to the 1997 HTML version 4 standard. For 2000 and later XHTML 1.x documents, the xml declaration was optional. For HTML version 5 documents, it's use is highly recommended.

Last updated Sunday September 19, 2010

You are currently viewing this page in HTML 5 non-XML* format (* see Clicklets for more infomation). This document is also available in XHTML 1 Style Sheet*XHTML 1* XML*HTML 5 Style Sheet*HTML 5 XML*HTML 4* XHTML Mobile* WML Mobile* and printer-friendly PDF* formats. This is accomplished with Single Source Publishing, a content management system that uses templates in XSLT style sheets provided by XML Styles .com to transform the source content for various content delivery channels. There is also RDF* metadata that describes the content of this document.


Copyright © 2010 Accilent® Corp. Alteration of content, including addition of any function such as hypertext links or pop-up advertising, or interference with the hypertext links or other functions of this site is expressly prohibited.

DISCLAIMER: All information, links, forms, applications and other items on this site or obtained from it are provided AS IS, WITHOUT WARRANTY OF ANY KIND EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.