To begin an XML document, it is a good idea to include the XML declaration
as the very first line of the document. I say "good idea" because, though
the XML declaration is optional, it is suggested by the W3C specification.
Essentially, the XML declaration is a processing instruction that notifies
the processing agent that the following document has been marked up as an
XML document. It will look something like the following:
<?xml version = "1.0"?>
We'll talk more about the gory details of processing instructions later,
but we can at least explain how the XML declaration works.
All processing instructions, including the XML declaration, begin with
<? and end with ?>. Following the initial <?,
you will find the name of the processing instruction, which in this case
The XML processing instruction, requires that you specify a "version"
attribute and allows you to specify optional "standalone" and "encoding"
In its full regalia, the XML declaration might look like the following:
<?xml version = "1.0" standalone = "yes" encoding = "UTF-8"?>