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 version attribute specifies the correct version of XML required to process the document, such as “1.0”. This attribute cannot be omitted.

encoding

The encoding attribute specifies the character encoding used in the document (e.g., “US-ASCII” or “iso- 8859-1”). This attribute is optional.

standalone

The optional standalone attribute specifies whether a DTD is required to parse the document. The value must be either yes or no. If the value is no, 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"?>

Get XML Pocket Reference 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.