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
versionattribute specifies the correct version of XML required to process the document, which is currently1.0. This attribute cannot be omitted.-
encoding The
encodingattribute specifies the character encoding used in the document (e.g.,UTF-8oriso-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
standaloneattribute specifies whether an external DTD is required to parse the document. The value must be eitheryesorno(the default). If the value isnoor 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"] ?>
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access