Name
<?xml ... ?>
Synopsis
<?xml version="
number
" [encoding="
encoding
" ] [standalone="
yes|no
"] ?>
Description
Although they are not required to, XML documents typically begin
with an XML declaration. An XML declaration must start with
the characters <?xml and end with the characters ?>.
Attributes
-
version The
versionattribute specifies the correct version of XML required to process the document, such as"1.0". This attribute cannot be omitted.-
encoding The
encodingattribute specifies the character encoding used in the document (e.g., “US-ASCII” or “iso-8859-1”). This attribute is optional.-
standalone The optional
standaloneattribute specifies whether a DTD is required to parse the document. The value must be eitheryesorno. If the value isno, a DTD must be declared with an XML<!DOCTYPE>instruction.
For example:
<?xml version="1.0"?> <?xml version="1.0" encoding="US-ASCII" standalone="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