Name
<?xml ...?>
Synopsis
Although they are not required to, XML documents typically begin with
an XML declaration, which must start with the characters
<?xml
and end with the characters
?>
. Attributes include:
Attributes
-
version
The
version
attribute specifies the correct version of XML required to process the document, which is currently1.0
. This attribute cannot be omitted.-
encoding
The
encoding
attribute specifies the character encoding used in the document (e.g.,UTF-8
oriso-8859-1
). UTF-8 and UTF-16 are the only encodings that an XML processor is required to handle. This attribute is optional.-
standalone
The optional
standalone
attribute specifies whether an external DTD is required to parse the document. The value must be eitheryes
orno
(the default). If the value isno
or the attribute is not present, a DTD must be declared with an XML<!DOCTYPE>
instruction. If it isyes
, no external DTD is required.
For example:
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="number
" [encoding="encoding
"] [standalone="yes|no"] ?>
Get Webmaster in a Nutshell, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.